function UpdateKernel($updates_dir, $arModules, &$strError, &$arErrorModules, &$arSuccessModules) { global $DB; $strError_tmp = ""; $stime = CUpdateSystem::getmicrotime(); $updates_dir_full = $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/".$updates_dir; if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full)) { $strError_tmp .= "[UUK01] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_NO_TMP_CAT")).".<br>"; } if (!is_array($arModules) || count($arModules)<=0) { $strError_tmp .= "[UUK02] ".GetMessage("SUPP_UK_NO_MODS").".<br>"; } if (strlen($strError_tmp)<=0) { if (!is_readable($updates_dir_full)) $strError_tmp .= "[UUK03] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_RD_TMP_CAT")).".<br>"; } if (strlen($strError_tmp)<=0) { for ($i = 0; $i < count($arModules); $i++) { $strError_tmp1 = ""; $from_dir = $updates_dir_full."/".$arModules[$i]; $to_dir = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$arModules[$i]; CUpdateSystem::CheckDirPath($to_dir."/", true); if (!file_exists($to_dir) || !is_dir($to_dir)) { $strError_tmp1 .= "[UUK04] ".str_replace("#MODULE_DIR#", $to_dir, GetMessage("SUPP_UK_NO_MODIR")).".<br>"; $arErrorModules[$arModules[$i]] = str_replace("#MODULE_DIR#", $to_dir, GetMessage("SUPP_UK_NO_MODIR"))." [UUK04]. "; } if (strlen($strError_tmp1)<=0) { if (!is_writable($to_dir)) { $strError_tmp1 .= "[UUK05] ".str_replace("#MODULE_DIR#", $to_dir, GetMessage("SUPP_UK_WR_MODIR")).".<br>"; $arErrorModules[$arModules[$i]] = str_replace("#MODULE_DIR#", $to_dir, GetMessage("SUPP_UK_WR_MODIR"))." [UUK05]. "; } } if (strlen($strError_tmp1)<=0) { if (!file_exists($from_dir) || !is_dir($from_dir)) { $strError_tmp1 .= "[UUK06] ".str_replace("#DIR#", $from_dir, GetMessage("SUPP_UK_NO_FDIR")).".<br>"; $arErrorModules[$arModules[$i]] = str_replace("#DIR#", $from_dir, GetMessage("SUPP_UK_NO_FDIR"))." [UUK06]. "; } } if (strlen($strError_tmp1)<=0) { if (!is_readable($from_dir)) { $strError_tmp1 .= "[UUK07] ".str_replace("#DIR#", $from_dir, GetMessage("SUPP_UK_READ_FDIR")).".<br>"; $arErrorModules[$arModules[$i]] = str_replace("#DIR#", $from_dir, GetMessage("SUPP_UK_READ_FDIR"))." [UUK07]. "; } } if (strlen($strError_tmp1)<=0) { $handle = @opendir($from_dir); $arUpdaters = array(); if ($handle) { while (false !== ($dir = readdir($handle))) { if (substr($dir, 0, 7)=="updater") { $bPostUpdater = "N"; if (is_file($from_dir."/".$dir)) { $num = substr($dir, 7, strlen($dir)-11); if (substr($dir, strlen($dir) - 9) == "_post.php") { $bPostUpdater = "Y"; $num = substr($dir, 7, strlen($dir)-16); } $arUpdaters[] = array("/".$dir, Trim($num), $bPostUpdater); } elseif (file_exists($from_dir."/".$dir."/index.php")) { $num = substr($dir, 7); if (substr($dir, strlen($dir) - 5) == "_post") { $bPostUpdater = "Y"; $num = substr($dir, 7, strlen($dir)-12); } $arUpdaters[] = array("/".$dir."/index.php", Trim($num), $bPostUpdater); } } } closedir($handle); } for ($i1 = 0; $i1 < count($arUpdaters)-1; $i1++) { for ($j1 = $i1 + 1; $j1 < count($arUpdaters); $j1++) { if (CUpdateSystem::CompareVersions($arUpdaters[$i1][1], $arUpdaters[$j1][1])>0) { $tmp1 = $arUpdaters[$i1]; $arUpdaters[$i1] = $arUpdaters[$j1]; $arUpdaters[$j1] = $tmp1; } } } } if (strlen($strError_tmp1)<=0) { if (strtolower($DB->type)=="mysql" && defined("MYSQL_TABLE_TYPE") && strlen(MYSQL_TABLE_TYPE)>0) { $DB->Query("SET storage_engine = '".MYSQL_TABLE_TYPE."'", True); } } if (strlen($strError_tmp1) <= 0) { for ($i1 = 0; $i1 < count($arUpdaters); $i1++) { if ($arUpdaters[$i1][2]=="N") { $strError_tmp2 = ""; CUpdateSystem::RunUpdaterScript($from_dir.$arUpdaters[$i1][0], $strError_tmp2, "/bitrix/updates/".$updates_dir."/".$arModules[$i], $arModules[$i]); if (strlen($strError_tmp2) > 0) { $strError_tmp1 .= str_replace("#MODULE#", $arModules[$i], str_replace("#VER#", $arUpdaters[$i1][1], GetMessage("SUPP_UK_UPDN_ERR"))).": ". $strError_tmp2.".<br>"; $arErrorModules[$arModules[$i]] = str_replace("#MODULE#", $arModules[$i], str_replace("#VER#", $arUpdaters[$i1][1], GetMessage("SUPP_UK_UPDN_ERR"))).": ". $strError_tmp2.".<br>"; $strError_tmp1 .= str_replace("#MODULE#", $arModules[$i], GetMessage("SUPP_UK_UPDN_ERR_BREAK"))." "; break; } } } } if (strlen($strError_tmp1) <= 0) { CUpdateSystem::CopyDirFiles($from_dir, $to_dir, $strError_tmp1); } if (strlen($strError_tmp1) <= 0) { for ($i1 = 0; $i1 < count($arUpdaters); $i1++) { if ($arUpdaters[$i1][2]=="Y") { $strError_tmp2 = ""; CUpdateSystem::RunUpdaterScript($from_dir.$arUpdaters[$i1][0], $strError_tmp2, "/bitrix/updates/".$updates_dir."/".$arModules[$i], $arModules[$i]); if (strlen($strError_tmp2) > 0) { $strError_tmp1 .= str_replace("#MODULE#", $arModules[$i], str_replace("#VER#", $arUpdaters[$i1][1], GetMessage("SUPP_UK_UPDY_ERR"))).": ". $strError_tmp2.".<br>"; $arErrorModules[$arModules[$i]] = str_replace("#MODULE#", $arModules[$i], str_replace("#VER#", $arUpdaters[$i1][1], GetMessage("SUPP_UK_UPDY_ERR"))).": ". $strError_tmp2.".<br>"; $strError_tmp1 .= str_replace("#MODULE#", $arModules[$i], GetMessage("SUPP_UK_UPDN_ERR_BREAK"))." "; break; } } } } if (strlen($strError_tmp1)>0) { $strError_tmp .= $strError_tmp1; $arErrorModules[$arModules[$i]] .= str_replace("#MODULE#", $arModules[$i], GetMessage("SUPP_UK_UPDN_ERR_BREAK1"))." "; } else { $arSuccessModules[$arModules[$i]] = "Y"; } } CUpdateSystem::DeleteDirFilesEx($updates_dir_full); } CUpdateSystem::AddMessage2Log("TIME UpdateKernel ".Round(CUpdateSystem::getmicrotime()-$stime, 3)." sec"); if (strlen($strError_tmp)>0) { CUpdateSystem::AddMessage2Log($strError_tmp, "CUUK"); $strError .= $strError_tmp; return False; } else return True; }
echo $j; ?> ]=<?php echo $arDepends[$j]; ?> ;<?php } } $arDepends1 = array(); if (is_array($arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"])) { for ($j = 0; $j < count($arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"]); $j++) { if (!array_key_exists($arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"][$j]["@"]["MODUL"], $arModuleCurVersions)) { $arModuleCurVersions[$arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"][$j]["@"]["MODUL"]] = CUpdateSystem::GetModuleVersion($arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"][$j]["@"]["MODUL"]); } $i_cur_version = $arModuleCurVersions[$arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"][$j]["@"]["MODUL"]]; if (!$i_cur_version || strlen($i_cur_version) <= 0 || CUpdateSystem::CompareVersions($arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"][$j]["@"]["VERSION"], $i_cur_version) > 0) { for ($k = 0; $k < count($arModulesUpdates["MODULES"]["#"]["MODULE"]); $k++) { if ($arModulesUpdates["MODULES"]["#"]["MODULE"][$i]["#"]["VERSION_CONTROL"][$j]["@"]["MODUL"] == $arModulesUpdates["MODULES"]["#"]["MODULE"][$k]["@"]["ID"]) { $arDepends1[] = $k; break; } } } } } if (count($arDepends1) > 0) { for ($j = 0; $j < count($arDepends1); $j++) { ?> arDepends1[<?php echo $j; ?>