Your IP : 172.28.240.42


Current Path : /var/www/html/clients/amz.e-nk.ru/bitrix/modules/main/admin/
Upload File :
Current File : /var/www/html/clients/amz.e-nk.ru/bitrix/modules/main/admin/update_system_partner_call.php

<?
//**********************************************************************/
//**    DO NOT MODIFY THIS FILE                                       **/
//**    MODIFICATION OF THIS FILE WILL ENTAIL SITE FAILURE            **/
//**********************************************************************/
if (!defined("UPD_INTERNAL_CALL") || UPD_INTERNAL_CALL != "Y")
{
	require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/update_client_partner.php");

	if(!$USER->CanDoOperation('install_updates') || !check_bitrix_sessid())
	{
		echo "*";
		die();
	}
}

@set_time_limit(0);
ini_set("track_errors", "1");
ignore_user_abort(true);

IncludeModuleLangFile(__FILE__);

$errorMessage = "";

$stableVersionsOnly = COption::GetOptionString("main", "stable_versions_only", "Y");

$queryType = "M";

$arRequestedModules = array();
if (array_key_exists("reqm", $_REQUEST))
{
	$arRequestedModulesTmp = explode(",", $_REQUEST["reqm"]);
	for ($i = 0, $cnt = count($arRequestedModulesTmp); $i < $cnt; $i++)
		if (!in_array($arRequestedModulesTmp[$i], $arRequestedModules))
			$arRequestedModules[] = $arRequestedModulesTmp[$i];
}
else
{
	$arRequestedModules = CUpdateClientPartner::GetRequestedModules($_REQUEST["addmodule"]);
}

COption::SetOptionString("main", "update_system_update", Date($GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL")), time()));
/************************************/
if (!CUpdateClientPartner::GetNextStepUpdates($errorMessage, LANG, $stableVersionsOnly, $arRequestedModules, array_key_exists("reqm", $_REQUEST)))
{
	$errorMessage .= "[CL01] ".GetMessage("SUPC_ME_LOAD").". ";
	CUpdateClientPartner::AddMessage2Log(GetMessage("SUPC_ME_LOAD"), "CL01");
}

if (StrLen($errorMessage) <= 0)
{
	$temporaryUpdatesDir = "";
	if (!CUpdateClientPartner::UnGzipArchive($temporaryUpdatesDir, $errorMessage, true))
	{
		$errorMessage .= "[CL02] ".GetMessage("SUPC_ME_PACK").". ";
		CUpdateClientPartner::AddMessage2Log(GetMessage("SUPC_ME_PACK"), "CL02");
	}
}

if (strlen($errorMessage) <= 0)
{
	if (!CUpdateClientPartner::CheckUpdatability($temporaryUpdatesDir, $errorMessage))
	{
		$errorMessage .= "[CL03] ".GetMessage("SUPC_ME_CHECK").". ";
		CUpdateClientPartner::AddMessage2Log(GetMessage("SUPC_ME_CHECK"), "CL03");
	}
}

$arStepUpdateInfo = array();
if (strlen($errorMessage) <= 0)
{
	$arStepUpdateInfo = CUpdateClientPartner::GetStepUpdateInfo($temporaryUpdatesDir, $errorMessage);
	//CUpdateClientPartner::AddMessage2Log(print_r($arStepUpdateInfo, true), "!!!!!");
}

if (StrLen($errorMessage) <= 0)
{
	if (isset($arStepUpdateInfo["DATA"]["#"]["ERROR"]))
	{
		for ($i = 0, $cnt = count($arStepUpdateInfo["DATA"]["#"]["ERROR"]); $i < $cnt; $i++)
			$errorMessage .= "[".$arStepUpdateInfo["DATA"]["#"]["ERROR"][$i]["@"]["TYPE"]."] ".$arStepUpdateInfo["DATA"]["#"]["ERROR"][$i]["#"];
	}
}

$arItemsUpdated = array();
$arItemsUpdatedDescr = array();
if (StrLen($errorMessage) <= 0)
{
	if (isset($arStepUpdateInfo["DATA"]["#"]["ITEM"]))
	{
		for ($i = 0, $cnt = count($arStepUpdateInfo["DATA"]["#"]["ITEM"]); $i < $cnt; $i++)
		{
			$arItemsUpdated[$arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["NAME"]] = $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["VALUE"];
			$arItemsUpdatedDescr[$arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["NAME"]] = $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["DESCR"];
		}
	}
}

if (StrLen($errorMessage) <= 0)
{
	if (isset($arStepUpdateInfo["DATA"]["#"]["NOUPDATES"]))
	{
		CUpdateClientPartner::ClearUpdateFolder($_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/".$temporaryUpdatesDir);
		CUpdateClientPartner::AddMessage2Log("Finish - NOUPDATES", "STEP");
		echo "FIN";
	}
	else
	{
		if (strlen($errorMessage) <= 0)
		{
			if (!CUpdateClientPartner::UpdateStepModules($temporaryUpdatesDir, $errorMessage))
			{
				$errorMessage .= "[CL04] ".GetMessage("SUPC_ME_UPDATE").". ";
				CUpdateClientPartner::AddMessage2Log(GetMessage("SUPC_ME_UPDATE"), "CL04");
			}
		}

		if (StrLen($errorMessage) > 0)
		{
			CUpdateClientPartner::AddMessage2Log("Error: ".$errorMessage, "UPD_ERROR");
			echo "ERR".$errorMessage;
		}
		else
		{
			echo "STP";
			echo count($arItemsUpdated)."|";
			$bFirst = True;
			foreach ($arItemsUpdated as $key => $value)
			{
				$strModuleDescr = "";
				if (strlen($arItemsUpdatedDescr[$key]) > 0)
				{
					$strModuleDescr = "<br>".htmlspecialcharsback($arItemsUpdatedDescr[$key]);
					$strModuleDescr = preg_replace("#</?pre>#i", " ", $strModuleDescr);
					$strModuleDescr = preg_replace("/[\s\n\r]+/", " ", $strModuleDescr);
					$strModuleDescr = addslashes($strModuleDescr);
				}

				CUpdateClientPartner::AddMessage2Log("Updated: ".$key.((StrLen($value) > 0) ? " (".$value.")" : "").$strModuleDescr, "UPD_SUCCESS");
				echo ($bFirst ? "" : ", ").$key.((StrLen($value) > 0) ? " (".$value.")" : "");
				$bFirst = False;
			}
		}
	}
}
else
{
	CUpdateClientPartner::AddMessage2Log("Error: ".$errorMessage, "UPD_ERROR");
	echo "ERR".$errorMessage;
}
/************************************/


if (!defined("UPD_INTERNAL_CALL") || UPD_INTERNAL_CALL != "Y")
{
	require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_after.php");
}
?>