1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
include.php
См. документацию.
1
<?php
2
3
IncludeModuleLangFile
(__FILE__);
4
// Never increase caching time here. There were cache clenup problems noticed.
5
if
(!defined(
'CACHED_b_cluster_dbnode'
))
6
{
7
define(
'CACHED_b_cluster_dbnode'
, 3600);
8
}
9
10
$dbType
=
\Bitrix\Main\Application::getConnection
()->getType();
11
12
CModule::AddAutoloadClasses(
13
'cluster'
, [
14
'CClusterGroup'
=>
'classes/general/group.php'
,
15
'CClusterQueue'
=>
'classes/general/queue.php'
,
16
'CAllClusterDBNode'
=>
'classes/general/dbnode.php'
,
17
'CClusterDBNode'
=>
'classes/'
.
$dbType
.
'/dbnode.php'
,
18
'CAllClusterDBNodeCheck'
=>
'classes/general/dbnode_check.php'
,
19
'CClusterDBNodeCheck'
=>
'classes/'
.
$dbType
.
'/dbnode_check.php'
,
20
'CClusterSlave'
=>
'classes/'
.
$dbType
.
'/slave.php'
,
21
'CClusterMemcache'
=>
'classes/general/memcache.php'
,
22
'CClusterRedis'
=>
'classes/general/redis.php'
,
23
'CClusterWebNode'
=>
'classes/general/webnode.php'
,
24
]
25
);
26
27
if
(defined(
'BX_CLUSTER_GROUP'
))
28
{
29
CClusterQueue::Run();
30
}
31
32
class
CCluster
33
{
34
public
static
function
checkForServers
($toBeAddedCount = 0)
35
{
36
$countLimit = (int) \
Bitrix
\Main\Config\Option::get(
'main'
,
'~PARAM_MAX_SERVERS'
, 0);
37
if
($countLimit > 0)
38
{
39
return
(self::getServersCount() + $toBeAddedCount) <= $countLimit;
40
}
41
else
42
{
43
return
true
;
44
}
45
}
46
47
public
static
function
getServersCount
()
48
{
49
static
$cache =
null
;
50
if
($cache ===
null
)
51
{
52
$hosts = [];
53
foreach
(self::getServerList() as $server)
54
{
55
if
($server[
'DEDICATED'
] ==
'Y'
)
56
{
57
$hosts[] = $server[
'HOST'
];
58
}
59
}
60
$cache =
count
(array_unique($hosts));
61
}
62
return
$cache;
63
}
64
65
public
static
function
getServerList
()
66
{
67
$cacheType = COption::GetOptionString(
'cluster'
,
'cache_type'
,
'memcache'
);
68
if
($cacheType ==
'memcache'
)
69
{
70
$cacheServers =
CClusterMemcache::getServerList
();
71
}
72
else
73
{
74
$cacheServers =
CClusterRedis::getServerList
();
75
}
76
$servers = array_merge(
77
CClusterDBNode::getServerList
()
78
,$cacheServers
79
,
CClusterWebNode::getServerList
()
80
);
81
if
(empty($servers))
82
{
83
$servers[] = [
84
'ID'
=> 0,
85
'HOST'
=>
''
,
86
'DEDICATED'
=>
'Y'
,
87
'EDIT_URL'
=>
''
,
88
];
89
}
90
return
$servers;
91
}
92
}
Bitrix\Cluster\ClusterCache\getServerList
static getServerList()
Определения
clustercache.php:15
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
CAllClusterDBNode\getServerList
static getServerList()
Определения
dbnode.php:451
CCluster
Определения
include.php:33
CCluster\getServersCount
static getServersCount()
Определения
include.php:47
CCluster\checkForServers
static checkForServers($toBeAddedCount=0)
Определения
include.php:34
CCluster\getServerList
static getServerList()
Определения
include.php:65
CClusterWebNode\getServerList
static getServerList()
Определения
webnode.php:300
$dbType
$dbType
Определения
autoload.php:6
IncludeModuleLangFile
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения
tools.php:3778
Bitrix
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
bitrix
modules
cluster
include.php
Создано системой
1.14.0