Exemplo n.º 1
0
 public function __construct()
 {
     if (self::$obMemcache == null) {
         self::$obMemcache = new \Memcache();
         $cacheConfig = Config\Configuration::getValue("cache");
         $v = isset($cacheConfig["memcache"]) ? $cacheConfig["memcache"] : null;
         if ($v != null && isset($v["host"]) && $v["host"] != "") {
             if ($v != null && isset($v["port"])) {
                 $port = intval($v["port"]);
             } else {
                 $port = 11211;
             }
             if (self::$obMemcache->connect($v["host"], $port)) {
                 self::$isConnected = true;
                 register_shutdown_function(array("\\Bitrix\\Main\\Data\\CacheEngineMemcache", "close"));
             }
         }
     }
     $v = Config\Configuration::getValue("cache");
     if ($v != null && isset($v["sid"]) && $v["sid"] != "") {
         $this->sid = $v["sid"];
     } else {
         $this->sid = "BX";
     }
 }
Exemplo n.º 2
0
 /**
  * Returns the file size.
  *
  * @return float|int
  * @throws FileNotFoundException
  * @throws FileOpenException
  */
 public function getSize()
 {
     if (!$this->isExists()) {
         throw new FileNotFoundException($this->originalPath);
     }
     static $supportLarge32 = null;
     if ($supportLarge32 === null) {
         $supportLarge32 = \Bitrix\Main\Config\Configuration::getValue("large_files_32bit_support") === true;
     }
     $size = 0;
     if (PHP_INT_SIZE < 8 && $supportLarge32) {
         // 32bit
         $this->open(FileStreamOpenMode::READ);
         if (fseek($this->filePointer, 0, SEEK_END) === 0) {
             $size = 0.0;
             $step = 0x7fffffff;
             while ($step > 0) {
                 if (fseek($this->filePointer, -$step, SEEK_CUR) === 0) {
                     $size += floatval($step);
                 } else {
                     $step >>= 1;
                 }
             }
         }
         $this->close();
     } else {
         // 64bit
         $size = filesize($this->getPhysicalPath());
     }
     return $size;
 }
Exemplo n.º 3
0
 public function __construct()
 {
     $v = \Bitrix\Main\Config\Configuration::getValue("cache");
     if ($v != null && isset($v["sid"]) && $v["sid"] != "") {
         $this->sid = $v["sid"];
     } else {
         $this->sid = "BX";
     }
 }
Exemplo n.º 4
0
 public function setStatus($status)
 {
     $httpStatus = \Bitrix\Main\Config\Configuration::getValue("http_status");
     $cgiMode = stristr(php_sapi_name(), "cgi") !== false;
     if ($cgiMode && ($httpStatus == null || $httpStatus == false)) {
         $this->addHeader("Status", $status);
     } else {
         $server = $this->context->getServer();
         $this->addHeader($server->get("SERVER_PROTOCOL") . " " . $status);
     }
 }
Exemplo n.º 5
0
    function SaveConfig($arServerList)
    {
        self::$arList = false;
        $isOnline = false;
        $content = '<' . '?
define("BX_MEMCACHE_CLUSTER", "' . EscapePHPString(CMain::GetServerUniqID()) . '");
$arList = array(
';
        $defGroup = 1;
        $arGroups = array();
        $rsGroups = CClusterGroup::GetList(array("ID" => "DESC"));
        while ($arGroup = $rsGroups->Fetch()) {
            $defGroup = $arGroups[$arGroup["ID"]] = intval($arGroup["ID"]);
        }
        foreach ($arServerList as $i => $arServer) {
            $isOnline |= $arServer["STATUS"] == "ONLINE";
            $GROUP_ID = intval($arServer["GROUP_ID"]);
            if (!array_key_exists($arServer["GROUP_ID"], $arGroups)) {
                $GROUP_ID = $defGroup;
            }
            $content .= "\t" . intval($i) . " => array(\n";
            $content .= "\t\t'ID' => \"" . EscapePHPString($arServer["ID"]) . "\",\n";
            $content .= "\t\t'GROUP_ID' => " . $GROUP_ID . ",\n";
            $content .= "\t\t'HOST' => \"" . EscapePHPString($arServer["HOST"]) . "\",\n";
            $content .= "\t\t'PORT' => " . intval($arServer["PORT"]) . ",\n";
            $content .= "\t\t'WEIGHT' => " . intval($arServer["WEIGHT"]) . ",\n";
            if ($arServer["STATUS"] == "ONLINE") {
                $content .= "\t\t'STATUS' => \"ONLINE\",\n";
            } elseif ($arServer["STATUS"] == "OFFLINE") {
                $content .= "\t\t'STATUS' => \"OFFLINE\",\n";
            } else {
                $content .= "\t\t'STATUS' => \"READY\",\n";
            }
            $content .= "\t),\n";
        }
        $content .= ');
?' . '>';
        file_put_contents($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/cluster/memcache.php", $content);
        bx_accelerator_reset();
        self::$systemConfigurationUpdate = null;
        $cache = \Bitrix\Main\Config\Configuration::getValue('cache');
        if ($isOnline) {
            if (!is_array($cache) || !isset($cache['type']) || !is_array($cache['type']) || !isset($cache['type']['class_name']) || !$cache['type']['class_name'] === 'CPHPCacheMemcacheCluster') {
                \Bitrix\Main\Config\Configuration::setValue('cache', array('type' => array('class_name' => 'CPHPCacheMemcacheCluster', 'extension' => 'memcache', 'required_file' => 'modules/cluster/classes/general/memcache_cache.php')));
                self::$systemConfigurationUpdate = true;
            }
        } else {
            if (is_array($cache) && isset($cache['type']) && is_array($cache['type']) && isset($cache['type']['class_name']) && $cache['type']['class_name'] === 'CPHPCacheMemcacheCluster') {
                \Bitrix\Main\Config\Configuration::setValue('cache', null);
                self::$systemConfigurationUpdate = false;
            }
        }
    }
Exemplo n.º 6
0
 /**
  * Search connection parameters (type, host, db, login and password) by connection name
  *
  * @param string $name Connection name
  * @return array|null
  * @throws \Bitrix\Main\ArgumentTypeException
  * @throws \Bitrix\Main\ArgumentNullException
  */
 private function searchConnectionParametersByName($name)
 {
     if (!is_string($name)) {
         throw new \Bitrix\Main\ArgumentTypeException("name", "string");
     }
     if ($name === "") {
         throw new \Bitrix\Main\ArgumentNullException("name");
     }
     $connectionsConfiguration = \Bitrix\Main\Config\Configuration::getValue('connections');
     if (isset($connectionsConfiguration[$name])) {
         return $connectionsConfiguration[$name];
     }
     /* TODO: exception, if config not found */
     return null;
 }
Exemplo n.º 7
0
 public static function getCurrentTemplateId($siteId)
 {
     $cacheFlags = Config\Configuration::getValue("cache_flags");
     $ttl = isset($cacheFlags["site_template"]) ? $cacheFlags["site_template"] : 0;
     $connection = Application::getConnection();
     $sqlHelper = $connection->getSqlHelper();
     $field = $connection->getType() === "mysql" ? "`CONDITION`" : "CONDITION";
     $path2templates = IO\Path::combine(Application::getDocumentRoot(), Application::getPersonalRoot(), "templates");
     if ($ttl === false) {
         $sql = "\n\t\t\t\tSELECT " . $field . ", TEMPLATE\n\t\t\t\tFROM b_site_template\n\t\t\t\tWHERE SITE_ID = '" . $sqlHelper->forSql($siteId) . "'\n\t\t\t\tORDER BY IF(LENGTH(" . $field . ") > 0, 1, 2), SORT\n\t\t\t\t";
         $recordset = $connection->query($sql);
         while ($record = $recordset->fetch()) {
             $condition = trim($record["CONDITION"]);
             if ($condition != '' && !@eval("return " . $condition . ";")) {
                 continue;
             }
             if (IO\Directory::isDirectoryExists($path2templates . "/" . $record["TEMPLATE"])) {
                 return $record["TEMPLATE"];
             }
         }
     } else {
         $managedCache = Application::getInstance()->getManagedCache();
         if ($managedCache->read($ttl, "b_site_template")) {
             $arSiteTemplateBySite = $managedCache->get("b_site_template");
         } else {
             $arSiteTemplateBySite = array();
             $sql = "\n\t\t\t\t\tSELECT " . $field . ", TEMPLATE, SITE_ID\n\t\t\t\t\tFROM b_site_template\n\t\t\t\t\tWHERE SITE_ID = '" . $sqlHelper->forSql($siteId) . "'\n\t\t\t\t\tORDER BY SITE_ID, IF(LENGTH(" . $field . ") > 0, 1, 2), SORT\n\t\t\t\t\t";
             $recordset = $connection->query($sql);
             while ($record = $recordset->fetch()) {
                 $arSiteTemplateBySite[$record['SITE_ID']][] = $record;
             }
             $managedCache->set("b_site_template", $arSiteTemplateBySite);
         }
         if (is_array($arSiteTemplateBySite[$siteId])) {
             foreach ($arSiteTemplateBySite[$siteId] as $record) {
                 $condition = trim($record["CONDITION"]);
                 if ($condition != '' && !@eval("return " . $condition . ";")) {
                     continue;
                 }
                 if (IO\Directory::isDirectoryExists($path2templates . "/" . $record["TEMPLATE"])) {
                     return $record["TEMPLATE"];
                 }
             }
         }
     }
     return ".default";
 }
Exemplo n.º 8
0
 protected function getCookieDomain()
 {
     static $bCache = false;
     static $cache = false;
     if ($bCache) {
         return $cache;
     }
     $context = Application::getInstance()->getContext();
     $server = $context->getServer();
     $cacheFlags = \Bitrix\Main\Config\Configuration::getValue("cache_flags");
     $cacheTtl = isset($cacheFlags["site_domain"]) ? $cacheFlags["site_domain"] : 0;
     if ($cacheTtl === false) {
         $connection = Application::getDbConnection();
         $sqlHelper = $connection->getSqlHelper();
         $sql = "SELECT DOMAIN " . "FROM b_lang_domain " . "WHERE '" . $sqlHelper->forSql('.' . $server->getHttpHost()) . "' like " . $sqlHelper->getConcatFunction("'%.'", "DOMAIN") . " " . "ORDER BY " . $sqlHelper->getLengthFunction("DOMAIN") . " ";
         $recordset = $connection->query($sql);
         if ($record = $recordset->fetch()) {
             $cache = $record['DOMAIN'];
         }
     } else {
         $managedCache = Application::getInstance()->getManagedCache();
         if ($managedCache->read($cacheTtl, "b_lang_domain", "b_lang_domain")) {
             $arLangDomain = $managedCache->get("b_lang_domain");
         } else {
             $arLangDomain = array("DOMAIN" => array(), "LID" => array());
             $connection = Application::getDbConnection();
             $sqlHelper = $connection->getSqlHelper();
             $recordset = $connection->query("SELECT * " . "FROM b_lang_domain " . "ORDER BY " . $sqlHelper->getLengthFunction("DOMAIN"));
             while ($record = $recordset->fetch()) {
                 $arLangDomain["DOMAIN"][] = $record;
                 $arLangDomain["LID"][$record["LID"]][] = $record;
             }
             $managedCache->set("b_lang_domain", $arLangDomain);
         }
         foreach ($arLangDomain["DOMAIN"] as $domain) {
             if (strcasecmp(substr('.' . $server->getHttpHost(), -(strlen($domain['DOMAIN']) + 1)), "." . $domain['DOMAIN']) == 0) {
                 $cache = $domain['DOMAIN'];
                 break;
             }
         }
     }
     $bCache = true;
     return $cache;
 }
Exemplo n.º 9
0
 public function __construct()
 {
     if (self::$obMemcache == null) {
         self::$obMemcache = new \Memcache();
         $cacheConfig = Config\Configuration::getValue("cache");
         $v = isset($cacheConfig["memcache"]) ? $cacheConfig["memcache"] : null;
         if ($v != null && isset($v["host"]) && $v["host"] != "") {
             if ($v != null && isset($v["port"])) {
                 $port = intval($v["port"]);
             } else {
                 $port = 11211;
             }
             if (self::$obMemcache->pconnect($v["host"], $port)) {
                 self::$isConnected = true;
             }
         }
     }
     $v = Config\Configuration::getValue("cache");
     if ($v != null && isset($v["sid"]) && $v["sid"] != "") {
         $this->sid = $v["sid"];
     } else {
         $this->sid = "BX";
     }
 }
Exemplo n.º 10
0
 public static function convertEncodingToCurrent($string)
 {
     $isUtf8String = self::detectUtf8($string);
     $isUtf8Config = Application::isUtfMode();
     $currentCharset = null;
     $context = Application::getInstance()->getContext();
     if ($context != null) {
         $culture = $context->getCulture();
         if ($culture != null && method_exists($culture, "getCharset")) {
             $currentCharset = $culture->getCharset();
         }
     }
     if ($currentCharset == null) {
         $currentCharset = Configuration::getValue("default_charset");
     }
     if ($currentCharset == null) {
         $currentCharset = "Windows-1251";
     }
     $fromCp = "";
     $toCp = "";
     if ($isUtf8Config && !$isUtf8String) {
         $fromCp = $currentCharset;
         $toCp = "UTF-8";
     } elseif (!$isUtf8Config && $isUtf8String) {
         $fromCp = "UTF-8";
         $toCp = $currentCharset;
     }
     if ($fromCp !== $toCp) {
         $string = self::convertEncoding($string, $fromCp, $toCp);
     }
     return $string;
 }
Exemplo n.º 11
0
 /**
  * Resets accelerator if any.
  */
 public static function resetAccelerator()
 {
     $fl = \Bitrix\Main\Config\Configuration::getValue("NoAcceleratorReset");
     if ($fl) {
         return;
     }
     if (function_exists("accelerator_reset")) {
         accelerator_reset();
     } elseif (function_exists("wincache_refresh_if_changed")) {
         wincache_refresh_if_changed();
     }
 }
Exemplo n.º 12
0
 protected function updateDigest($userId, $password)
 {
     if (empty($userId)) {
         throw new Main\ArgumentNullException("userId");
     }
     if (!Main\Type\Int::isInteger($userId)) {
         throw new Main\ArgumentTypeException("userId");
     }
     $userId = intval($userId);
     $connection = Main\Application::getDbConnection();
     $sqlHelper = $connection->getSqlHelper();
     $recordset = $connection->query("SELECT U.LOGIN, UD.DIGEST_HA1 " . "FROM b_user U " . "   LEFT JOIN b_user_digest UD on U.ID = UD.USER_ID " . "WHERE U.ID = " . $userId);
     if ($record = $recordset->fetch()) {
         $realm = Main\Config\Configuration::getValue("http_auth_realm");
         if (is_null($realm)) {
             $realm = "Bitrix Site Manager";
         }
         $digest = md5($record["LOGIN"] . ':' . $realm . ':' . $password);
         if ($record["DIGEST_HA1"] == '') {
             //new digest
             $connection->queryExecute("INSERT INTO b_user_digest (USER_ID, DIGEST_HA1) " . "VALUES('" . $userId . "', '" . $sqlHelper->forSql($digest) . "')");
         } else {
             //update digest (login, password or realm were changed)
             if ($record["DIGEST_HA1"] !== $digest) {
                 $connection->queryExecute("UPDATE b_user_digest SET " . "   DIGEST_HA1 = '" . $sqlHelper->forSql($digest) . "' " . "WHERE USER_ID = " . $userId);
             }
         }
     }
 }
Exemplo n.º 13
0
 private static function getCacheTtl()
 {
     $cacheFlags = Configuration::getValue("cache_flags");
     if (!isset($cacheFlags["config_options"])) {
         return 0;
     }
     return $cacheFlags["config_options"];
 }
Exemplo n.º 14
0
 protected function initializeExceptionHandler()
 {
     $exceptionHandler = new Diag\ExceptionHandler();
     $exceptionHandling = Config\Configuration::getValue("exception_handling");
     if ($exceptionHandling == null) {
         $exceptionHandling = array();
     }
     if (!isset($exceptionHandling["debug"]) || !is_bool($exceptionHandling["debug"])) {
         $exceptionHandling["debug"] = false;
     }
     $exceptionHandler->setDebugMode($exceptionHandling["debug"]);
     if (isset($exceptionHandling["handled_errors_types"]) && is_int($exceptionHandling["handled_errors_types"])) {
         $exceptionHandler->setHandledErrorsTypes($exceptionHandling["handled_errors_types"]);
     }
     if (isset($exceptionHandling["exception_errors_types"]) && is_int($exceptionHandling["exception_errors_types"])) {
         $exceptionHandler->setExceptionErrorsTypes($exceptionHandling["exception_errors_types"]);
     }
     if (isset($exceptionHandling["ignore_silence"]) && is_bool($exceptionHandling["ignore_silence"])) {
         $exceptionHandler->setIgnoreSilence($exceptionHandling["ignore_silence"]);
     }
     if (isset($exceptionHandling["assertion_throws_exception"]) && is_bool($exceptionHandling["assertion_throws_exception"])) {
         $exceptionHandler->setAssertionThrowsException($exceptionHandling["assertion_throws_exception"]);
     }
     if (isset($exceptionHandling["assertion_error_type"]) && is_int($exceptionHandling["assertion_error_type"])) {
         $exceptionHandler->setAssertionErrorType($exceptionHandling["assertion_error_type"]);
     }
     $exceptionHandlerOutput = $this->createExceptionHandlerOutput();
     $exceptionHandlerLog = $this->createExceptionHandlerLog(isset($exceptionHandling["log"]) && is_array($exceptionHandling["log"]) ? $exceptionHandling["log"] : array());
     $exceptionHandler->initialize($exceptionHandlerOutput, $exceptionHandlerLog);
     $this->exceptionHandler = $exceptionHandler;
 }
Exemplo n.º 15
0
 public function getDefaultConnectionType()
 {
     $params = Config\Configuration::getValue('connections');
     if (isset($params[static::DEFAULT_CONNECTION_NAME]) && !empty($params[static::DEFAULT_CONNECTION_NAME])) {
         $cn = $params[static::DEFAULT_CONNECTION_NAME]['className'];
         if ($cn === "\\Bitrix\\Main\\DB\\MysqlConnection" || $cn === "\\Bitrix\\Main\\DB\\MysqliConnection") {
             return 'MYSQL';
         } elseif ($cn === "\\Bitrix\\Main\\DB\\OracleConnection") {
             return 'ORACLE';
         } else {
             return 'MSSQL';
         }
     }
     return strtoupper($GLOBALS["DBType"]);
 }
Exemplo n.º 16
0
 protected function handleException(Exception $e)
 {
     if ($this->isAjaxRequest()) {
         $this->sendJsonResponse(array('status' => static::STATUS_ERROR, 'message' => $e->getMessage()));
     } else {
         $exceptionHandling = Config\Configuration::getValue("exception_handling");
         if ($exceptionHandling["debug"]) {
             throw $e;
         }
     }
 }
Exemplo n.º 17
0
 /**
  * @return Cache
  */
 public static function createInstance()
 {
     $cacheEngine = null;
     // Events can't be used here because events use cache
     $cacheType = "files";
     $v = \Bitrix\Main\Config\Configuration::getValue("cache");
     if ($v != null && isset($v["type"]) && !empty($v["type"])) {
         $cacheType = $v["type"];
     }
     if (is_array($cacheType)) {
         if (isset($cacheType["class_name"])) {
             if (!isset($cacheType["extension"]) || extension_loaded($cacheType["extension"])) {
                 if (isset($cacheType["required_file"]) && ($requiredFile = \Bitrix\Main\Loader::getLocal($cacheType["required_file"]))) {
                     require_once $requiredFile;
                 }
                 $className = $cacheType["class_name"];
                 if (class_exists($className)) {
                     $cacheEngine = new $className();
                 }
             }
         }
     } else {
         switch ($cacheType) {
             case "memcache":
                 if (extension_loaded('memcache')) {
                     $cacheEngine = new CacheEngineMemcache();
                 }
                 break;
             case "eaccelerator":
                 if (extension_loaded('eaccelerator')) {
                     $cacheEngine = new CacheEngineEAccelerator();
                 }
                 break;
             case "apc":
                 if (extension_loaded('apc')) {
                     $cacheEngine = new CacheEngineApc();
                 }
                 break;
             case "files":
                 $cacheEngine = new CacheEngineFiles();
                 break;
             default:
                 break;
         }
     }
     if ($cacheEngine == null) {
         throw new \Bitrix\Main\Config\ConfigurationException("Cache engine is not found");
     }
     if (!$cacheEngine->isAvailable()) {
         throw new \Bitrix\Main\SystemException("Cache engine is not available");
     }
     /*
     $v = \Bitrix\Main\Config\Configuration::getValue("cache");
     if ($v != null && isset($v["type"]))
     {
     	$cacheType = $v["type"];
     	if (is_array($cacheType))
     	{
     		if (isset($cacheType["class_name"]))
     		{
     			if (!isset($cacheType["extension"]) || extension_loaded($cacheType["extension"]))
     			{
     				if (isset($cacheType["required_file"]) && ($requiredFile = \Bitrix\Main\Loader::getLocal($cacheType["required_file"])))
     					require_once($requiredFile);
     
     				$className = $cacheType["class_name"];
     				if (class_exists($className))
     					$cacheEngine = new $className();
     			}
     		}
     	}
     	else
     	{
     		switch ($cacheType)
     		{
     			case "memcache":
     				if (extension_loaded('memcache'))
     					$cacheEngine = new CacheEngineMemcache();
     				break;
     			case "eaccelerator":
     				if (extension_loaded('eaccelerator'))
     					$cacheEngine = new CacheEngineEAccelerator();
     				break;
     			case "apc":
     				if (extension_loaded('apc'))
     					$cacheEngine = new CacheEngineApc();
     				break;
     			default:
     				break;
     		}
     	}
     
     	if (($cacheEngine != null) && !$cacheEngine->isAvailable())
     		$cacheEngine = null;
     }
     
     if ($cacheEngine == null)
     	$cacheEngine = new CacheEngineFiles();
     */
     return new self($cacheEngine);
 }
Exemplo n.º 18
0
 /**
  * Return true if exception_handling debug = false
  *
  * @return bool
  * @since 14.0.0
  */
 protected function checkExceptionDebug()
 {
     $exceptionConfig = \Bitrix\Main\Config\Configuration::getValue('exception_handling');
     return !(is_array($exceptionConfig) && isset($exceptionConfig['debug']) && $exceptionConfig['debug']);
 }
Exemplo n.º 19
0
 public static function createCacheEngine()
 {
     $cacheEngine = null;
     // Events can't be used here because events use cache
     $cacheType = "files";
     $v = Config\Configuration::getValue("cache");
     if ($v != null && isset($v["type"]) && !empty($v["type"])) {
         $cacheType = $v["type"];
     }
     if (is_array($cacheType)) {
         if (isset($cacheType["class_name"])) {
             if (!isset($cacheType["extension"]) || extension_loaded($cacheType["extension"])) {
                 if (isset($cacheType["required_file"]) && ($requiredFile = Main\Loader::getLocal($cacheType["required_file"])) !== false) {
                     require_once $requiredFile;
                 }
                 if (isset($cacheType["required_remote_file"])) {
                     require_once $cacheType["required_remote_file"];
                 }
                 $className = $cacheType["class_name"];
                 if (class_exists($className)) {
                     $cacheEngine = new $className();
                 }
             }
         }
     } else {
         switch ($cacheType) {
             case "memcache":
                 if (extension_loaded('memcache')) {
                     $cacheEngine = new CacheEngineMemcache();
                 }
                 break;
             case "eaccelerator":
                 if (extension_loaded('eaccelerator')) {
                     $cacheEngine = new CacheEngineEAccelerator();
                 }
                 break;
             case "apc":
                 if (extension_loaded('apc')) {
                     $cacheEngine = new CacheEngineApc();
                 }
                 break;
             case "xcache":
                 if (extension_loaded('xcache')) {
                     $cacheEngine = new CacheEngineXCache();
                 }
                 break;
             case "files":
                 $cacheEngine = new CacheEngineFiles();
                 break;
             case "none":
                 $cacheEngine = new CacheEngineNone();
                 break;
             default:
                 break;
         }
     }
     if ($cacheEngine == null) {
         $cacheEngine = new CacheEngineNone();
         trigger_error("Cache engine is not found", E_USER_WARNING);
     }
     if (!$cacheEngine->isAvailable()) {
         $cacheEngine = new CacheEngineNone();
         trigger_error("Cache engine is not available", E_USER_WARNING);
     }
     return $cacheEngine;
 }
Exemplo n.º 20
0
 protected static function getDirectoryIndexArray()
 {
     static $directoryIndexDefault = array("index.php" => 1, "index.html" => 1, "index.htm" => 1, "index.phtml" => 1, "default.html" => 1, "index.php3" => 1);
     $directoryIndex = Main\Config\Configuration::getValue("directory_index");
     if ($directoryIndex !== null) {
         return $directoryIndex;
     }
     return $directoryIndexDefault;
 }
Exemplo n.º 21
0
 /**
  * Resets accelerator if any.
  */
 public static function resetAccelerator()
 {
     if (defined("BX_NO_ACCELERATOR_RESET")) {
         return;
     }
     $fl = Config\Configuration::getValue("no_accelerator_reset");
     if ($fl) {
         return;
     }
     if (function_exists("accelerator_reset")) {
         accelerator_reset();
     } elseif (function_exists("wincache_refresh_if_changed")) {
         wincache_refresh_if_changed();
     }
 }
Exemplo n.º 22
0
 /**
  * Return true if exception_handling debug = false
  *
  * @return bool
  * @since 14.0.0
  */
 protected function checkExceptionDebug()
 {
     $exceptionConfig = \Bitrix\Main\Config\Configuration::getValue('exception_handling');
     if (is_array($exceptionConfig) && isset($exceptionConfig['debug']) && $exceptionConfig['debug']) {
         return self::STATUS_FAILED;
     } else {
         return self::STATUS_PASSED;
     }
 }
Exemplo n.º 23
0
 /**
  * Search connection parameters (type, host, db, login and password) by connection name
  *
  * @param string $name Connection name
  * @return array('type' => string, 'host' => string, 'db_name' => string, 'login' => string, 'password' => string, "init_command" => string, "options" => string)|null
  * @throws \Bitrix\Main\ArgumentTypeException
  * @throws \Bitrix\Main\ArgumentNullException
  */
 private function searchConnectionParametersByName($name)
 {
     if (!is_string($name)) {
         throw new \Bitrix\Main\ArgumentTypeException("name", "string");
     }
     if ($name === "") {
         throw new \Bitrix\Main\ArgumentNullException("name");
     }
     if ($name === self::DEFAULT_CONNECTION) {
         $v = \Bitrix\Main\Config\Configuration::getValue(self::DEFAULT_CONNECTION_CONFIGURATION);
         if ($v != null) {
             return $v;
         }
         $DBType = "";
         $DBHost = "";
         $DBName = "";
         $DBLogin = "";
         $DBPassword = "";
         include \Bitrix\Main\IO\Path::convertRelativeToAbsolute("/bitrix/php_interface/dbconn.php");
         return array("type" => $DBType, "host" => $DBHost, "db_name" => $DBName, "login" => $DBLogin, "password" => $DBPassword);
     }
     /* TODO: реализовать */
     return null;
 }
Exemplo n.º 24
0
	protected function getAuditors()
	{
		$wafConfig = \Bitrix\Main\Config\Configuration::getValue("waf");
		if (is_array($wafConfig) && isset($wafConfig['auditors']))
			return $wafConfig['auditors'];

		return $this->defaultAuditors;
	}
Exemplo n.º 25
0
 protected function initializeBitrix()
 {
     $this->getApplication()->initializeBitrix();
     $connections = Configuration::getValue('connections');
     foreach ($connections as $name => $parameters) {
         Application::getInstance()->getConnectionPool()->cloneConnection($name, $name, $parameters);
     }
 }