• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/update_class.php
  • Класс: CUpdateSystem
  • Вызов: CUpdateSystem::UpdateHelp
static function UpdateHelp($updates_dir, $arHelp, &$strError, &$arErrorHelp, &$arSuccessHelp)
{
	$strError_tmp = "";

	CUpdateSystem::AddMessage2Log("exec CUpdateSystem::UpdateHelp");
	$stime = CUpdateSystem::getmicrotime();

	$updates_dir_full = $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/".$updates_dir;
	$help_dir_full = $_SERVER["DOCUMENT_ROOT"]."/bitrix/help";

	if (!is_array($arHelp) || empty($arHelp))
	{
		$strError_tmp .= "[UUH00] ".GetMessage("SUPP_UH_NO_LANG").".
"; } if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full)) { $strError_tmp .= "[UUH01] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_NO_TMP_CAT")).".
"; } if ($strError_tmp == '') { if (!is_readable($updates_dir_full)) $strError_tmp .= "[UUH03] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_RD_TMP_CAT")).".
"; } if ($strError_tmp == '') { CUpdateSystem::CheckDirPath($help_dir_full."/", true); if (!file_exists($help_dir_full) || !is_dir($help_dir_full)) { $strError_tmp .= "[UUH02] ".str_replace("#FILE#", $help_dir_full, GetMessage("SUPP_UH_NO_HELP_CAT")).".
"; } elseif (!is_writable($help_dir_full)) { $strError_tmp .= "[UUH03] ".str_replace("#FILE#", $help_dir_full, GetMessage("SUPP_UH_NO_WRT_HELP")).".
"; } } if ($strError_tmp == '') { for ($i = 0, $ni = count($arHelp); $i < $ni; $i++) { $strError_tmp1 = ""; $from_dir = $updates_dir_full."/".$arHelp[$i]; if (!file_exists($from_dir) || !is_dir($from_dir)) { $strError_tmp1 .= "[UUH04] ".str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_TMP_LANG")).".
"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_TMP_LANG"))." [UUH04]. "; } if ($strError_tmp1 == '') { if (!is_readable($from_dir)) { $strError_tmp1 .= "[UUH05] ".str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_READ_LANG")).".
"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_READ_LANG"))." [UUH05]. "; } } if ($strError_tmp1 == '') { if (file_exists($help_dir_full."/".$arHelp[$i]."_tmp")) { CUpdateSystem::DeleteDirFilesEx($help_dir_full."/".$arHelp[$i]."_tmp"); } if (file_exists($help_dir_full."/".$arHelp[$i]."_tmp")) { $strError_tmp1 .= "[UUH06] ".str_replace("#FILE#", $help_dir_full."/".$arHelp[$i]."_tmp", GetMessage("SUPP_UH_CANT_DEL")).".
"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i]."_tmp", GetMessage("SUPP_UH_CANT_DEL"))." [UUH06]. "; } } if ($strError_tmp1 == '') { if (file_exists($help_dir_full."/".$arHelp[$i])) { if (!rename($help_dir_full."/".$arHelp[$i], $help_dir_full."/".$arHelp[$i]."_tmp")) { $strError_tmp1 .= "[UUH07] ".str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_RENAME")).".
"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_RENAME"))." [UUH07]. "; } } } if ($strError_tmp1 == '') { CUpdateSystem::CheckDirPath($help_dir_full."/".$arHelp[$i]."/", true); if (!file_exists($help_dir_full."/".$arHelp[$i]) || !is_dir($help_dir_full."/".$arHelp[$i])) { $strError_tmp1 .= "[UUH08] ".str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_CREATE")).".
"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_CREATE"))." [UUH08]. "; } elseif (!is_writable($help_dir_full."/".$arHelp[$i])) { $strError_tmp1 .= "[UUH09] ".str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_WRITE")).".
"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_WRITE"))." [UUH09]. "; } } if ($strError_tmp1 == '') { CUpdateSystem::CopyDirFiles( $from_dir, $help_dir_full."/".$arHelp[$i], $strError_tmp1); } if ($strError_tmp1 <> '') { $strError_tmp .= $strError_tmp1; $arErrorHelp[$arHelp[$i]] .= str_replace("#HELP#", $arHelp[$i], GetMessage("SUPP_UH_INST_BREAK"))." "; } else { $arSuccessHelp[$arHelp[$i]] = "Y"; if (file_exists($help_dir_full."/".$arHelp[$i]."_tmp")) { CUpdateSystem::DeleteDirFilesEx($help_dir_full."/".$arHelp[$i]."_tmp"); } } } CUpdateSystem::DeleteDirFilesEx($updates_dir_full); } CUpdateSystem::AddMessage2Log("TIME UpdateHelp ".Round(CUpdateSystem::getmicrotime()-$stime, 3)." sec"); if ($strError_tmp <> '') { CUpdateSystem::AddMessage2Log($strError_tmp, "CUUH"); $strError .= $strError_tmp; return false; } else return true; }