Beispiel #1
0
	function CheckUpdatability($updates_dir, &$strError)
	{
		$strError_tmp = "";

		$updates_dir_full = $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/".$updates_dir;
		if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
		{
			$strError_tmp .= "[UCU01] ".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 .= "[UCU02] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_RD_TMP_CAT")).".<br>";
			}
		}

		if ($handle = @opendir($updates_dir_full))
		{
			while (($file = readdir($handle)) !== false)
			{
				if ($file == "." || $file == "..") continue;

				if (is_dir($updates_dir_full."/".$file))
				{
					CUpdateSystem::CheckUpdatability($updates_dir."/".$file, $strError_tmp);
				}
				elseif (is_file($updates_dir_full."/".$file))
				{
					$strRealPath = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".substr($updates_dir."/".$file, strpos($updates_dir."/".$file, "/"));
					if (file_exists($strRealPath))
					{
						if (!is_writeable($strRealPath))
						{
							$strError_tmp .= "[UCU03] ".str_replace("#FILE#", $strRealPath, GetMessage("SUPP_CU_MAIN_ERR_FILE")).".<br>";
						}
					}
					else
					{
						$p = CUpdateSystem::bxstrrpos($strRealPath, "/");
						$strRealPath = substr($strRealPath, 0, $p);

						if (strlen($strRealPath)>1)
							$strRealPath = rtrim($strRealPath, "/");

						$p = CUpdateSystem::bxstrrpos($strRealPath, "/");
						while ($p > 0)
						{
							if (file_exists($strRealPath) && is_dir($strRealPath))
							{
								if (!is_writable($strRealPath))
									$strError_tmp .= "[UCU04] ".str_replace("#FILE#", $strRealPath, GetMessage("SUPP_CU_MAIN_ERR_CAT")).".<br>";

								break;
							}
							$strRealPath = substr($strRealPath, 0, $p);
							$p = CUpdateSystem::bxstrrpos($strRealPath, "/");
						}
					}
				}
			}
			@closedir($handle);
		}

		if (strlen($strError_tmp)>0)
		{
			CUpdateSystem::AddMessage2Log($strError_tmp, "CUCU");
			$strError .= $strError_tmp;
			return False;
		}
		else
			return True;
	}
Beispiel #2
0
     }
 } else {
     $archiveFileName = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/updates/update_archive.gz";
     if (!file_exists($archiveFileName) || !is_file($archiveFileName)) {
         $strErrorMessage .= str_replace("#FILE#", $archiveFileName, GetMessage("SUP_NO_TEMP_FILE")) . " [PU3021]. ";
     }
 }
 if (strlen($strErrorMessage) <= 0) {
     $temporary_updates_dir = "";
     if (!CUpdateSystem::UnGzipArchive($temporary_updates_dir, $strErrorMessage, "Y")) {
         $strErrorMessage .= GetMessage("SUP_UPD_LOAD_BREAK") . " [PU303]. ";
         CUpdateSystem::AddMessage2Log(GetMessage("SUP_UPD_LOAD_BREAK"), "PU303");
     }
 }
 if (strlen($strErrorMessage) <= 0) {
     if (!CUpdateSystem::CheckUpdatability($temporary_updates_dir, $strErrorMessage)) {
         $strErrorMessage .= GetMessage("SUP_UPD_LOAD_BREAK") . " [PU304]. ";
         CUpdateSystem::AddMessage2Log(GetMessage("SUP_UPD_LOAD_BREAK"), "PU304");
     }
 }
 $arModulesUpdates = false;
 if (strlen($strErrorMessage) <= 0) {
     $arModulesUpdates = CUpdateSystem::GetLoadedModuleUpdates($temporary_updates_dir, $strErrorMessage);
 }
 if (strlen($strErrorMessage) <= 0) {
     if (!CUpdateSystem::CheckVersions($arModulesUpdates, $strErrorMessage, false)) {
         $strErrorMessage .= GetMessage("SUP_UPD_LOAD_BREAK") . " [PU305]. ";
         CUpdateSystem::AddMessage2Log(GetMessage("SUP_UPD_LOAD_BREAK"), "PU305");
     }
 }
 if (strlen($strErrorMessage) > 0) {