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) || count($arHelp)<=0) { $strError_tmp .= "[UUH00] ".GetMessage("SUPP_UH_NO_LANG").".<br>"; } 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")).".<br>"; } if (strlen($strError_tmp)<=0) { if (!is_readable($updates_dir_full)) $strError_tmp .= "[UUH03] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_RD_TMP_CAT")).".<br>"; } if (strlen($strError_tmp)<=0) { 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")).".<br>"; } elseif (!is_writable($help_dir_full)) { $strError_tmp .= "[UUH03] ".str_replace("#FILE#", $help_dir_full, GetMessage("SUPP_UH_NO_WRT_HELP")).".<br>"; } } if (strlen($strError_tmp)<=0) { for ($i = 0; $i < count($arHelp); $i++) { $strError_tmp1 = ""; $from_dir = $updates_dir_full."/".$arHelp[$i]; if (strlen($strError_tmp1)<=0) { if (!file_exists($from_dir) || !is_dir($from_dir)) { $strError_tmp1 .= "[UUH04] ".str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_TMP_LANG")).".<br>"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_TMP_LANG"))." [UUH04]. "; } } if (strlen($strError_tmp1)<=0) { if (!is_readable($from_dir)) { $strError_tmp1 .= "[UUH05] ".str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_READ_LANG")).".<br>"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $from_dir, GetMessage("SUPP_UL_NO_READ_LANG"))." [UUH05]. "; } } if (strlen($strError_tmp1)<=0) { 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")).".<br>"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i]."_tmp", GetMessage("SUPP_UH_CANT_DEL"))." [UUH06]. "; } } if (strlen($strError_tmp1)<=0) { 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")).".<br>"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_RENAME"))." [UUH07]. "; } } } if (strlen($strError_tmp1)<=0) { 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")).".<br>"; $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")).".<br>"; $arErrorHelp[$arHelp[$i]] = str_replace("#FILE#", $help_dir_full."/".$arHelp[$i], GetMessage("SUPP_UH_CANT_WRITE"))." [UUH09]. "; } } if (strlen($strError_tmp1)<=0) { CUpdateSystem::CopyDirFiles( $from_dir, $help_dir_full."/".$arHelp[$i], $strError_tmp1); } if (strlen($strError_tmp1)>0) { $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 (strlen($strError_tmp)>0) { CUpdateSystem::AddMessage2Log($strError_tmp, "CUUH"); $strError .= $strError_tmp; return False; } else return True; }