function LoadSources(&$strError, $lang = false, $stableVersionsOnly = "Y") { $strError_tmp = ""; CUpdateSystem::AddMessage2Log("exec CUpdateSystem::LoadSources"); if ($lang===false) $lang = LANGUAGE_ID; $stableVersionsOnly = (($stableVersionsOnly == "N") ? "N" : "Y"); $arClientModules = CUpdateSystem::GetModules($strError_tmp); if (strlen($strError_tmp)<=0) { $GLOBALS["DB"]->GetVersion(); $strVars = "LICENSE_KEY=".urlencode(md5(CUpdateSystem::GetLicenseKey())). "&lang=".urlencode($lang). "&UTYPES=".urlencode("S"). "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION). "&COUNT_ONLY=".urlencode("F"). "&SUPD_STS=".urlencode(CUpdateSystem::GetFooPath("GetList")). "&CLIENT_SITE=".urlencode($_SERVER["SERVER_NAME"]). "&SUPD_DBS=".urlencode($GLOBALS["DB"]->type). "&XE=".urlencode(($GLOBALS["DB"]->XE) ? "Y" : "N"). "&CANGZIP=".urlencode((CUpdateSystem::IsGzipInstalled()) ? "Y" : "N"). "&CLIENT_PHPVER=".urlencode(phpversion()). "&stable=".urlencode($stableVersionsOnly). "&".CUpdateSystem::ModulesArray2Query($arClientModules, "bitm_"); CUpdateSystem::AddMessage2Log(preg_replace("/LICENSE_KEY=[^&]*/i", "LICENSE_KEY=X", $strVars)); $stime = CUpdateSystem::getmicrotime(); $fcontent = CUpdateSystem::getHTTPPage("bit_sysserver.php", $strVars, $strError_tmp); CUpdateSystem::AddMessage2Log("TIME LoadSources.getHTTPPage ".Round(CUpdateSystem::getmicrotime()-$stime, 3)." sec"); if (strlen($fcontent)<=0) $strError_tmp .= "[ULS01] ".GetMessage("SUPP_AS_EMPTY_RESP").".<br>"; } if (strlen($strError_tmp)<=0) { if (!($fp1 = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/update_archive.gz", "wb"))) $strError_tmp .= "[ULS02] ".str_replace("#FILE#", $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates", GetMessage("SUPP_RV_ER_TEMP_FILE")).".<br>"; } if (strlen($strError_tmp)<=0) { if (!fwrite($fp1, $fcontent)) $strError_tmp .= "[ULS03] ".str_replace("#FILE#", $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/update_archive.gz", GetMessage("SUPP_RV_WRT_TEMP_FILE")).".<br>"; @fclose($fp1); } if (strlen($strError_tmp)<=0) { $temporary_updates_dir = ""; if (!CUpdateSystem::UnGzipArchive($temporary_updates_dir, $strError_tmp, "Y")) $strError_tmp .= "[ULS04] ".GetMessage("SUPP_LS_LOAD_BREAK").".<br>"; } if (strlen($strError_tmp)<=0) { $updates_dir_full = $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/".$temporary_updates_dir; if (!file_exists($updates_dir_full."/update_info.xml") || !is_file($updates_dir_full."/update_info.xml")) $strError_tmp .= "[ULS05] ".str_replace("#FILE#", $updates_dir_full."/update_info.xml", GetMessage("SUPP_RV_ER_DESCR_FILE")).".<br>"; } if (strlen($strError_tmp)<=0) { if (!is_readable($updates_dir_full."/update_info.xml")) $strError_tmp .= "[ULS06] ".str_replace("#FILE#", $updates_dir_full."/update_info.xml", GetMessage("SUPP_RV_READ_DESCR_FILE")).".<br>"; } if (strlen($strError_tmp)<=0) { $content = file_get_contents($updates_dir_full."/update_info.xml"); } //echo "!1!".htmlspecialchars($content)."!2!"; if (strlen($strError_tmp)<=0) { $arRes = Array(); CUpdateSystem::ParseServerData($content, $arRes, $strError_tmp); } if (strlen($strError_tmp)<=0) { if (isset($arRes["DATA"]["#"]["ERROR"]) && is_array($arRes["DATA"]["#"]["ERROR"]) && count($arRes["DATA"]["#"]["ERROR"])>0) { for ($i = 0; $i < count($arRes["DATA"]["#"]["ERROR"]); $i++) { if (strlen($arRes["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"])>0) $strError_tmp .= "[".$arRes["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"]."] "; $strError_tmp .= $arRes["DATA"]["#"]["ERROR"][$i]["#"].".<br>"; } } } if (strlen($strError_tmp)<=0) { if (!CUpdateSystem::CheckUpdatability($temporary_updates_dir, $strError_tmp)) $strError_tmp .= "[ULS07] ".GetMessage("SUPP_LS_LOAD_BREAK").".<br>"; } if (strlen($strError_tmp)<=0) { foreach ($arClientModules as $module_id => $version) { $strError_tmp1 = ""; $from_dir = $updates_dir_full."/".$module_id; $to_dir = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$module_id; if (!file_exists($to_dir) || !is_dir($to_dir)) { $strError_tmp1 .= "[ULS08] ".str_replace("#MODULE#", $module_id, GetMessage("SUPP_LS_NO_MOD_CAT")).".<br>"; } elseif (!is_writable($to_dir)) { $strError_tmp1 .= "[ULS09] ".str_replace("#MODULE#", $module_id, GetMessage("SUPP_LS_WR_MOD_CAT")).".<br>"; } if (!file_exists($from_dir) || !is_dir($from_dir)) { $strError_tmp1 .= "[ULS10] ".str_replace("#MODULE#", $module_id, GetMessage("SUPP_LS_NO_SRC_MOD")).".<br>"; } elseif (!is_readable($from_dir)) { $strError_tmp1 .= "[ULS11] ".str_replace("#MODULE#", $module_id, GetMessage("SUPP_LS_RD_SRC_MOD")).".<br>"; } if (strlen($strError_tmp1)<=0) { CUpdateSystem::CopyDirFiles($from_dir, $to_dir, $strError_tmp1); } if (strlen($strError_tmp1) > 0) { CUpdateSystem::AddMessage2Log("Error loading sources for ".$module_id."!", "CULS"); $strError_tmp .= $strError_tmp1; } else { CUpdateSystem::AddMessage2Log("Sources loaded for ".$module_id."!", "CULS"); } } } if (strlen($strError_tmp)<=0) { CUpdateSystem::DeleteDirFilesEx($updates_dir_full); } if (strlen($strError_tmp)>0) { CUpdateSystem::AddMessage2Log($strError_tmp, "CULS"); $strError .= $strError_tmp; return False; } else return True; }
if (strlen($strErrorMessage) <= 0) { CUpdateSystem::AddMessage2Log("Query loading helps: " . $load_help); if (strlen($load_help) <= 0) { $strErrorMessage .= GetMessage("SUP_EMPTY_HELP_LANG") . " [PUH301]. "; CUpdateSystem::AddMessage2Log(GetMessage("SUP_EMPTY_HELP_LANG"), "PUH301"); } } if (strlen($strErrorMessage) <= 0) { if (!CUpdateSystem::LoadHelpUpdates(array($load_help), $strErrorMessage, LANG, $stableVersionsOnly)) { $strErrorMessage .= GetMessage("SUP_HELP_LOAD_BREAK") . " [PUH302]. "; CUpdateSystem::AddMessage2Log(GetMessage("SUP_HELP_LOAD_BREAK"), "PUH302"); } } if (strlen($strErrorMessage) <= 0) { $temporary_updates_dir = ""; if (!CUpdateSystem::UnGzipArchive($temporary_updates_dir, $strErrorMessage, "Y")) { $strErrorMessage .= GetMessage("SUP_HELP_LOAD_BREAK") . " [PUH303]. "; CUpdateSystem::AddMessage2Log(GetMessage("SUP_HELP_LOAD_BREAK"), "PUH303"); } } $arHelpUpdates = false; if (strlen($strErrorMessage) <= 0) { $arHelpUpdates = CUpdateSystem::GetLoadedHelpUpdates($temporary_updates_dir, $strErrorMessage); } $arErrorHelp = array(); $arSuccessHelp = array(); if (strlen($strErrorMessage) <= 0) { if (strlen($UNIID) > 0) { $_SESSION[$UNIID] = "Y"; } if (!CUpdateSystem::UpdateHelp($temporary_updates_dir, array($load_help), $strErrorMessage, $arErrorHelp, $arSuccessHelp)) {