1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
sitesdata.php
См. документацию.
1
<?php
2
namespace
Bitrix\Scale;
3
use Bitrix\Main\SiteDomainTable;
4
9
class
SitesData
10
{
16
public
static
function
getSite
($siteName, $dbName =
false
)
17
{
18
if
($siteName ==
''
)
19
throw
new \Bitrix\Main\ArgumentNullException(
"siteName"
);
20
21
$result
=
array
();
22
$sites
=
self::getList
($dbName);
23
24
if
(isset(
$sites
[$siteName]))
25
$result
=
$sites
[$siteName];
26
27
return
$result
;
28
}
29
33
public
static
function
getKernelSite
()
34
{
35
foreach
(self::getList() as
$siteId
=> $siteParams)
36
if
($siteParams[
'SiteInstall'
] ==
'kernel'
)
37
return
$siteId
;
38
39
return
''
;
40
}
41
45
public
static
function
getKernelsList
()
46
{
47
$result
=
array
();
48
49
foreach
(self::getList() as
$siteId
=> $siteParams)
50
if
($siteParams[
'SiteInstall'
] ==
'kernel'
)
51
$result
[
$siteId
] = isset($siteParams[
'NAME'
]) ? $siteParams[
'NAME'
] :
$siteId
;
52
53
return
$result
;
54
}
55
59
public
static
function
getKernelRoot
()
60
{
61
foreach
(self::getList() as
$siteId
=> $siteParams)
62
if
($siteParams[
'SiteInstall'
] ==
'kernel'
)
63
return
$siteParams[
'DocumentRoot'
];
64
65
return
''
;
66
}
67
72
public
static
function
getList
($dbName =
false
)
73
{
74
static
$hitCache =
null
;
75
76
if
($hitCache ===
null
)
77
{
78
$resSite =
array
();
79
$shellAdapter =
new
ShellAdapter
();
80
$execRes = $shellAdapter->syncExec(
"sudo -u root /opt/webdir/bin/bx-sites -o json -a list --hiden"
);
81
$sitesData = $shellAdapter->getLastOutput();
82
83
if
($execRes)
84
{
85
$arData = json_decode($sitesData,
true
);
86
87
if
(isset($arData[
"params"
]))
88
$resSite = $arData[
"params"
];
89
90
$domains =
array
();
91
$sdRes = SiteDomainTable::getList();
92
93
while
($dom = $sdRes->fetch())
94
{
95
if
(isset($domains[$dom[
'LID'
]]))
96
$domains[$dom[
'LID'
]] .=
', '
;
97
else
98
$domains[$dom[
'LID'
]] =
''
;
99
100
$domains[$dom[
'LID'
]] .= $dom[
'DOMAIN'
];
101
}
102
103
$rsSite =
\Bitrix\Main\SiteTable::getList
();
104
105
while
(
$site
= $rsSite->fetch())
106
{
107
foreach
($resSite as
$siteId
=> $siteInfo)
108
{
109
$docRoot
=
$site
[
"DOC_ROOT"
] <>
''
?
$site
[
"DOC_ROOT"
] :
\Bitrix\Main\Application::getDocumentRoot
();
110
111
if
($siteInfo[
"DocumentRoot"
] ==
$docRoot
)
112
{
113
$resSite[
$siteId
][
"NAME"
] =
$site
[
"NAME"
].
" ("
.
$site
[
"LID"
].
") "
;
114
$resSite[
$siteId
][
"LID"
] =
$site
[
"LID"
];
115
$resSite[
$siteId
][
"EMAIL"
] =
$site
[
"EMAIL"
];
116
$resSite[
$siteId
][
"DOMAINS"
] = isset($domains[
$site
[
"LID"
]]) ? $domains[
$site
[
"LID"
]] :
''
;
117
}
118
else
119
{
120
$resSite[
$siteId
][
"NAME"
] =
$siteId
;
121
}
122
123
$resSite[
$siteId
][
"SMTP_USE_AUTH"
] = ($siteInfo[
'SMTPPassword'
] !==
null
&& $siteInfo[
'SMTPUser'
] !==
null
) ?
'Y'
:
'N'
;
124
}
125
}
126
}
127
128
$hitCache = $resSite;
129
}
130
131
if
($dbName !=
false
&& !empty($hitCache))
132
{
133
$result
=
array
();
134
135
foreach
($hitCache as
$siteId
=> $siteInfo)
136
if
($siteInfo[
'DBName'
] == $dbName)
137
$result
[
$siteId
] = $siteInfo;
138
}
139
else
140
{
141
$result
= $hitCache;
142
}
143
144
return
$result
;
145
}
146
}
Bitrix\Main\Application\getDocumentRoot
static getDocumentRoot()
Определения
application.php:736
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Scale\ShellAdapter
Определения
shelladapter.php:10
Bitrix\Scale\SitesData
Определения
sitesdata.php:10
Bitrix\Scale\SitesData\getKernelSite
static getKernelSite()
Определения
sitesdata.php:33
Bitrix\Scale\SitesData\getList
static getList($dbName=false)
Определения
sitesdata.php:72
Bitrix\Scale\SitesData\getKernelRoot
static getKernelRoot()
Определения
sitesdata.php:59
Bitrix\Scale\SitesData\getSite
static getSite($siteName, $dbName=false)
Определения
sitesdata.php:16
Bitrix\Scale\SitesData\getKernelsList
static getKernelsList()
Определения
sitesdata.php:45
$sites
$sites
Определения
clear_component_cache.php:15
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$docRoot
$docRoot
Определения
options.php:20
$siteId
$siteId
Определения
ajax.php:8
$site
$site
Определения
yandex_run.php:614
bitrix
modules
scale
lib
sitesdata.php
Создано системой
1.14.0