- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/update_class.php
- Класс: CUpdateSystem
- Вызов: CUpdateSystem::AddSites
static function AddSites($strCheck, &$strError, $lang = false, $stableVersionsOnly = "Y")
{
$strError_tmp = "";
CUpdateSystem::AddMessage2Log("exec CUpdateSystem::AddSites");
if ($lang===false)
$lang = LANGUAGE_ID;
$stableVersionsOnly = (($stableVersionsOnly == "N") ? "N" : "Y");
if ($strCheck == '')
{
$strError_tmp .= "[UAS01] ".GetMessage("SUPP_AS_NO_CHECK").".
";
}
if ($strError_tmp == '')
{
$GLOBALS["DB"]->GetVersion();
$strVars = "LICENSE_KEY=".urlencode(md5(CUpdateSystem::GetLicenseKey())).
"&CLIENT_SITE=".urlencode($_SERVER["SERVER_NAME"]).
"&CANGZIP=".urlencode((CUpdateSystem::IsGzipInstalled()) ? "Y" : "N").
"&UTYPES=".urlencode("W").
"&COUNT_ONLY=".urlencode("Y").
"&SUPD_STS=".urlencode(CUpdateSystem::GetFooPath("GetList")).
"&SUPD_DBS=".urlencode($GLOBALS["DB"]->type).
"&XE=".urlencode((isset($GLOBALS["DB"]->XE) && $GLOBALS["DB"]->XE) ? "Y" : "N").
"&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
"&CHECK=".urlencode($strCheck).
"&CLIENT_PHPVER=".urlencode(phpversion()).
"&stable=".urlencode($stableVersionsOnly).
"&lang=".urlencode($lang);
CUpdateSystem::AddMessage2Log(preg_replace("/LICENSE_KEY=[^&]*/i", "LICENSE_KEY=X", $strVars));
$stime = CUpdateSystem::getmicrotime();
$content = CUpdateSystem::getHTTPPage("bit_sysserver.php", $strVars, $strError_tmp);
CUpdateSystem::AddMessage2Log("TIME AddSites.getHTTPPage ".Round(CUpdateSystem::getmicrotime()-$stime, 3)." sec");
if ($content == '')
$strError_tmp .= "[UAS02] ".GetMessage("SUPP_AS_EMPTY_RESP").".
";
}
if ($strError_tmp == '')
{
$arRes = Array();
CUpdateSystem::ParseServerData($content, $arRes, $strError_tmp);
}
if ($strError_tmp == '')
{
if (isset($arRes["DATA"]["#"]["ERROR"])
&& is_array($arRes["DATA"]["#"]["ERROR"])
&& !empty($arRes["DATA"]["#"]["ERROR"]))
{
for ($i = 0, $n = count($arRes["DATA"]["#"]["ERROR"]); $i < $n; $i++)
{
if ($arRes["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"] <> '')
$strError_tmp .= "[".$arRes["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"]."] ";
$strError_tmp .= $arRes["DATA"]["#"]["ERROR"][$i]["#"].".
";
}
}
}
if ($strError_tmp == '')
{
CUpdateSystem::AddMessage2Log("Check applied successfully!", "CUAS");
}
if ($strError_tmp <> '')
{
CUpdateSystem::AddMessage2Log($strError_tmp, "CUAS");
$strError .= $strError_tmp;
return false;
}
else
return true;
}