- Модуль: security
- Путь к файлу: ~/bitrix/modules/security/classes/general/session_mc.php
- Класс: CSecuritySessionMC
- Вызов: CSecuritySessionMC::newConnection
static function newConnection()
{
$result = false;
$exception = null;
if (!extension_loaded('memcache'))
{
$result = false;
$exception = new ErrorException("memcache extention not loaded.", 0, E_USER_ERROR, __FILE__, __LINE__);
}
if (!$exception)
{
if (!self::isStorageEnabled())
{
$result = false;
$exception = new ErrorException("BX_SECURITY_SESSION_MEMCACHE_HOST constant is not defined.", 0, E_USER_ERROR, __FILE__, __LINE__);
}
}
if (!$exception)
{
$port = defined("BX_SECURITY_SESSION_MEMCACHE_PORT")? intval(BX_SECURITY_SESSION_MEMCACHE_PORT): 11211;
self::$connection = new Memcache;
$result = self::$connection->pconnect(BX_SECURITY_SESSION_MEMCACHE_HOST, $port);
if (!$result)
{
$error = error_get_last();
if ($error && $error["type"] == E_WARNING)
{
$exception = new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
}
}
}
if ($exception)
{
$application = BitrixMainApplication::getInstance();
$exceptionHandler = $application->getExceptionHandler();
$exceptionHandler->writeToLog($exception);
}
return $result;
}