1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
migrator.php
См. документацию.
1<?php
8
9namespace Bitrix\Main\Config;
10
12{
13 public static function wnc()
14 {
15 $ar = array(
16 "default_charset" => array("value" => defined('BX_DEFAULT_CHARSET') ? BX_DEFAULT_CHARSET : null, "readonly" => false),
17 "no_accelerator_reset" => array("value" => defined('BX_NO_ACCELERATOR_RESET'), "readonly" => false),
18 "http_status" => array("value" => (defined('BX_HTTP_STATUS') && BX_HTTP_STATUS), "readonly" => false),
19 );
20
21 $cache = array();
22 if (defined('BX_CACHE_SID'))
23 $cache["sid"] = BX_CACHE_SID;
24 if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/cluster/memcache.php"))
25 {
26 $arList = null;
27 include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/cluster/memcache.php");
28 if (defined("BX_MEMCACHE_CLUSTER") && is_array($arList))
29 {
30 foreach ($arList as $listKey => $listVal)
31 {
32 $bOtherGroup = defined("BX_CLUSTER_GROUP") && ($listVal["GROUP_ID"] !== BX_CLUSTER_GROUP);
33
34 if (($listVal["STATUS"] !== "ONLINE") || $bOtherGroup)
35 unset($arList[$listKey]);
36 }
37
38 if (!empty($arList))
39 {
40 $cache["type"] = array(
41 "extension" => "memcache",
42 "required_file" => "modules/cluster/classes/general/memcache_cache.php",
43 "class_name" => "CPHPCacheMemcacheCluster",
44 );
45 }
46 }
47 }
48 if (!isset($cache["type"]))
49 {
50 if (defined('BX_CACHE_TYPE'))
51 {
52 $cache["type"] = BX_CACHE_TYPE;
53
54 switch ($cache["type"])
55 {
56 case "memcache":
57 case "CPHPCacheMemcache":
58 $cache["type"] = "memcache";
59 break;
60 case "eaccelerator":
61 case "CPHPCacheEAccelerator":
62 $cache["type"] = "eaccelerator";
63 break;
64 case "apc":
65 case "CPHPCacheAPC":
66 $cache["type"] = "apc";
67 break;
68 case "xcache":
69 case "CPHPCacheXCache":
70 $cache["type"] = array(
71 "extension" => "xcache",
72 "required_file" => "modules/main/classes/general/cache_xcache.php",
73 "class_name" => "CPHPCacheXCache",
74 );
75 break;
76 default:
77 if (defined("BX_CACHE_CLASS_FILE") && file_exists(BX_CACHE_CLASS_FILE))
78 {
79 $cache["type"] = array(
80 "required_remote_file" => BX_CACHE_CLASS_FILE,
81 "class_name" => BX_CACHE_TYPE
82 );
83 }
84 else
85 {
86 $cache["type"] = "files";
87 }
88 break;
89 }
90 }
91 else
92 {
93 $cache["type"] = "files";
94 }
95 }
96 if (defined("BX_MEMCACHE_PORT"))
97 $cache["memcache"]["port"] = intval(BX_MEMCACHE_PORT);
98 if (defined("BX_MEMCACHE_HOST"))
99 $cache["memcache"]["host"] = BX_MEMCACHE_HOST;
100 $ar["cache"] = array("value" => $cache, "readonly" => false);
101
102 $cacheFlags = array();
103 $arCacheConsts = array("CACHED_b_option" => "config_options");
104 foreach ($arCacheConsts as $const => $name)
105 $cacheFlags[$name] = defined($const) ? constant($const) : 0;
106 $ar["cache_flags"] = array("value" => $cacheFlags, "readonly" => false);
107
108 $ar["cookies"] = array("value" => array("secure" => false, "http_only" => true), "readonly" => false);
109
110 $ar["exception_handling"] = array(
111 "value" => array(
112 "debug" => true,
113 "handled_errors_types" => E_ALL & ~E_NOTICE & ~E_USER_NOTICE,
114 "exception_errors_types" => E_ALL & ~E_NOTICE & ~E_WARNING & ~E_USER_NOTICE & ~E_USER_WARNING & ~E_COMPILE_WARNING & ~E_DEPRECATED,
115 "ignore_silence" => false,
116 "assertion_throws_exception" => true,
117 "assertion_error_type" => E_USER_ERROR,
118 "log" => array(
119 /*"class_name" => "...",
120 "extension" => "...",
121 "required_file" => "...",*/
122 "settings" => array(
123 "file" => "bitrix/modules/error.log",
124 "log_size" => 1000000
125 )
126 ),
127 ),
128 "readonly" => false
129 );
130
132
133 $dbClassName = defined('BX_USE_MYSQLI') && BX_USE_MYSQLI === true ? "\\Bitrix\\Main\\DB\\MysqliConnection" : "\\Bitrix\\Main\\DB\\MysqlConnection";
134
135 $ar['connections']['value']['default'] = array(
136 'className' => $dbClassName,
137 'host' => $DBHost,
138 'database' => $DBName,
139 'login' => $DBLogin,
140 'password' => $DBPassword,
141 'options' => ((defined('DBPersistent') && DBPersistent) ? 1 : 0) | ((defined("DELAY_DB_CONNECT") && DELAY_DB_CONNECT === true) ? 2 : 0)
142 );
143 $ar['connections']['readonly'] = true;
144
145 $configuration = Configuration::getInstance();
146
147 foreach ($ar as $k => $v)
148 {
149 if ($configuration->get($k) === null)
150 {
151 if ($v["readonly"])
152 $configuration->addReadonly($k, $v["value"]);
153 else
154 $configuration->add($k, $v["value"]);
155 }
156 }
157
158 $configuration->saveConfiguration();
159
160 $filename1 = $_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/after_connect.php";
161 $filename2 = $_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/after_connect_d7.php";
162 if (file_exists($filename1) && !file_exists($filename2))
163 {
164 $source = file_get_contents($filename1);
165 $source = trim($source);
166 $source = preg_replace("#\\\$DB->Query\‍(#i", "\$this->queryExecute(", $source);
167 file_put_contents($filename2, $source);
168 }
169 }
170}
static getInstance($moduleId=null)
Определения configuration.php:45
static wnc()
Определения migrator.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DBHost
Определения start.php:35
global $DBName
Определения start.php:35
global $DBPassword
Определения start.php:35
global $DBLogin
Определения start.php:35
$name
Определения menu_edit.php:35
$ar
Определения options.php:199
$k
Определения template_pdf.php:567