72 public static function getList($dbName =
false)
74 static $hitCache =
null;
76 if($hitCache ===
null)
80 $execRes = $shellAdapter->syncExec(
"sudo -u root /opt/webdir/bin/bx-sites -o json -a list --hiden");
81 $sitesData = $shellAdapter->getLastOutput();
85 $arData = json_decode($sitesData,
true);
87 if(isset($arData[
"params"]))
88 $resSite = $arData[
"params"];
91 $sdRes = SiteDomainTable::getList();
93 while($dom = $sdRes->fetch())
95 if(isset($domains[$dom[
'LID']]))
96 $domains[$dom[
'LID']] .=
', ';
98 $domains[$dom[
'LID']] =
'';
100 $domains[$dom[
'LID']] .= $dom[
'DOMAIN'];
103 $rsSite = \Bitrix\Main\SiteTable::getList();
105 while ($site = $rsSite->fetch())
107 foreach($resSite as $siteId => $siteInfo)
109 $docRoot = $site[
"DOC_ROOT"] <>
'' ? $site[
"DOC_ROOT"] : \Bitrix\Main\Application::getDocumentRoot();
111 if($siteInfo[
"DocumentRoot"] == $docRoot)
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"]] :
'';
120 $resSite[$siteId][
"NAME"] = $siteId;
123 $resSite[$siteId][
"SMTP_USE_AUTH"] = ($siteInfo[
'SMTPPassword'] !==
null && $siteInfo[
'SMTPUser'] !==
null) ?
'Y' :
'N';
128 $hitCache = $resSite;
131 if($dbName !=
false && !empty($hitCache))
135 foreach($hitCache as $siteId => $siteInfo)
136 if($siteInfo[
'DBName'] == $dbName)
137 $result[$siteId] = $siteInfo;