%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.188.168.78 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/main/lib/composite/internals/ |
Upload File : |
<? namespace Bitrix\Main\Composite\Internals; use Bitrix\Main\Application; use Bitrix\Main\DB\MysqlCommonConnection; class Locker { const CONNECTION_NAME = "composite"; /** * Tries to obtain a lock with a name given by the string $id * Supports only Mysql. * * @param string $id Lock Name. * @return bool Returns true if lock was obtained. */ public static function lock($id) { $result = true; $connection = static::getConnection(); if ($connection instanceof MysqlCommonConnection) { $result = $connection->lock($id); } return $result; } /** * Releases the lock named by the string $id * Supports only Mysql * * @param string $id Lock Name. * @return bool Returns true if lock was released. */ public static function unlock($id) { $connection = static::getConnection(); if ($connection instanceof MysqlCommonConnection) { $connection->unlock($id); } return true; } /** * Gets a new connection for the lock mechanism * @return \Bitrix\Main\DB\Connection */ private static function getConnection() { $pool = Application::getInstance()->getConnectionPool(); $connection = $pool->getConnection(static::CONNECTION_NAME); if (!$connection) { $connection = $pool->cloneConnection( $pool::DEFAULT_CONNECTION_NAME, static::CONNECTION_NAME ); } return $connection; } }