7if (!defined(
"BX_DIR_PERMISSIONS"))
8 define(
"BX_DIR_PERMISSIONS", 0755);
10if (!defined(
"US_SHARED_KERNEL_PATH"))
11 define(
"US_SHARED_KERNEL_PATH",
"/bitrix");
17 return (!defined(
"US_BITRIX24_MODE") || !US_BITRIX24_MODE) && file_exists(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/classes/general/update_db_updater.php");
33 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
35 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
36 "&SUBSCR_EMAIL=".urlencode($strEmails).
38 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
39 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
40 "&CLIENT_PHPVER=".urlencode(phpversion()).
41 "&lang=".urlencode(
$lang);
46 $strError_tmp .=
"[USU058] Empty server response.<br>";
61 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
65 $strError_tmp .=
"[UAS01] ".GetMessage(
"SUPP_AS_NO_CHECK").
".<br>";
68 if ($strError_tmp ==
'')
73 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
75 "&UTYPES=".urlencode(
"W").
76 "&COUNT_ONLY=".urlencode(
"Y").
78 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
79 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
80 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
82 "&CLIENT_PHPVER=".urlencode(phpversion()).
83 "&stable=".urlencode($stableVersionsOnly).
84 "&lang=".urlencode(
$lang);
88 $stime = microtime(
true);
93 $strError_tmp .=
"[UAS02] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
96 if ($strError_tmp ==
'')
102 if ($strError_tmp ==
'')
104 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
105 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
106 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
110 if (
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"] <>
'')
111 $strError_tmp .=
"[".$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"].
"] ";
113 $strError_tmp .=
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"#"].
".<br>";
118 if ($strError_tmp ==
'')
123 if ($strError_tmp <>
'')
140 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
148 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
150 "&UTYPES=".urlencode(
"R").
151 "&COUNT_ONLY=".urlencode(
"F").
154 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
155 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
156 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
157 "&CLIENT_PHPVER=".urlencode(phpversion()).
158 "&stable=".urlencode($stableVersionsOnly).
159 "&lang=".urlencode(
$lang);
163 $stime = microtime(
true);
168 $strError_tmp .=
"[URV01] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
170 if ($strError_tmp ==
'')
172 if (!($fp1 = fopen(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
"wb")))
173 $strError_tmp .=
"[URV02] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates",
GetMessage(
"SUPP_RV_ER_TEMP_FILE")).
".<br>";
176 if ($strError_tmp ==
'')
178 if (!fwrite($fp1, $fcontent))
179 $strError_tmp .=
"[URV03] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
GetMessage(
"SUPP_RV_WRT_TEMP_FILE")).
".<br>";
184 if ($strError_tmp ==
'')
186 $temporary_updates_dir =
"";
188 $strError_tmp .=
"[URV04] ".GetMessage(
"SUPP_RV_BREAK").
".<br>";
191 if ($strError_tmp ==
'')
193 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$temporary_updates_dir;
194 if (!file_exists($updates_dir_full.
"/update_info.xml") || !is_file($updates_dir_full.
"/update_info.xml"))
196 $strError_tmp .=
"[URV05] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_ER_DESCR_FILE")).
".<br>";
200 if ($strError_tmp ==
'')
202 if (!is_readable($updates_dir_full.
"/update_info.xml"))
203 $strError_tmp .=
"[URV06] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_READ_DESCR_FILE")).
".<br>";
206 if ($strError_tmp ==
'')
208 $content = file_get_contents($updates_dir_full.
"/update_info.xml");
211 if ($strError_tmp ==
'')
217 if ($strError_tmp ==
'')
219 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
220 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
221 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
225 if (
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"] <>
'')
226 $strError_tmp .=
"[".$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"].
"] ";
228 $strError_tmp .=
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"#"].
".<br>";
233 if ($strError_tmp ==
'')
235 if (!file_exists($updates_dir_full.
"/include.php") || !is_file($updates_dir_full.
"/include.php"))
237 $strError_tmp .=
"[URV07] ".GetMessage(
"SUPP_RV_NO_FILE").
".<br>";
241 if ($strError_tmp ==
'')
243 $newfilesize = @filesize($updates_dir_full.
"/include.php");
244 if (intval($newfilesize)!=intval(
$arRes[
"DATA"][
"#"][
"FILE"][0][
"@"][
"SIZE"]))
246 $strError_tmp .=
"[URV08] ".GetMessage(
"SUPP_RV_ER_SIZE").
".<br>";
250 if ($strError_tmp ==
'')
252 if (!is_writeable(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include.php"))
254 $strError_tmp .=
"[URV09] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include.php",
GetMessage(
"SUPP_RV_NO_WRITE")).
".<br>";
258 if ($strError_tmp ==
'')
260 if (!copy($updates_dir_full.
"/include.php",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include.php"))
261 $strError_tmp .=
"[URV10] ".GetMessage(
"SUPP_RV_ERR_COPY").
".<br>";
262 @chmod(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include.php", BX_FILE_PERMISSIONS);
265 if ($strError_tmp ==
'')
267 $strongUpdateCheck = COption::GetOptionString(
"main",
"strong_update_check",
"Y");
269 if ($strongUpdateCheck ==
"Y")
271 $crc32_old = dechex(crc32(file_get_contents($updates_dir_full.
"/include.php")));
272 $crc32_new = dechex(crc32(file_get_contents(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include.php")));
273 if ($crc32_new != $crc32_old)
274 $strError_tmp .=
"[URV1011] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include.php",
GetMessage(
"SUPP_UGA_FILE_CRUSH")).
".<br>";
278 if ($strError_tmp ==
'')
284 if ($strError_tmp <>
'')
305 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
310 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
312 "&UTYPES=".urlencode(
"U").
314 "&COUNT_ONLY=".urlencode(
"F").
315 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
316 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
317 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
318 "&CLIENT_PHPVER=".urlencode(phpversion()).
319 "&stable=".urlencode($stableVersionsOnly).
320 "&lang=".urlencode(
$lang);
327 $strError_tmp .=
"[UUU01] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
329 if ($strError_tmp ==
'')
331 if (!($fp1 = fopen(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
"wb")))
332 $strError_tmp .=
"[UUU02] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates",
GetMessage(
"SUPP_RV_ER_TEMP_FILE")).
".<br>";
335 if ($strError_tmp ==
'')
337 if (!fwrite($fp1, $fcontent))
338 $strError_tmp .=
"[UUU03] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
GetMessage(
"SUPP_RV_WRT_TEMP_FILE")).
".<br>";
343 if ($strError_tmp ==
'')
345 $temporary_updates_dir =
"";
347 $strError_tmp .=
"[UUU04] ".GetMessage(
"SUPP_UU_BREAK").
".<br>";
350 if ($strError_tmp ==
'')
352 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$temporary_updates_dir;
353 if (!file_exists($updates_dir_full.
"/update_info.xml") || !is_file($updates_dir_full.
"/update_info.xml"))
354 $strError_tmp .=
"[UUU05] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_ER_DESCR_FILE")).
".<br>";
357 if ($strError_tmp ==
'')
359 if (!is_readable($updates_dir_full.
"/update_info.xml"))
360 $strError_tmp .=
"[URV06] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_READ_DESCR_FILE")).
".<br>";
363 if ($strError_tmp ==
'')
365 $content = file_get_contents($updates_dir_full.
"/update_info.xml");
368 if ($strError_tmp ==
'')
374 if ($strError_tmp ==
'')
376 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
377 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
378 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
382 if (
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"] <>
'')
383 $strError_tmp .=
"[".$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"].
"] ";
385 $strError_tmp .=
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"#"].
".<br>";
390 if ($strError_tmp ==
'')
393 "UUU072"=>
"update_class.php",
394 "UUU075"=>
"update_log.php",
396 foreach($aFiles as $err=>$file)
397 if(!file_exists($updates_dir_full.
"/main/classes/general/".$file) || !is_file($updates_dir_full.
"/main/classes/general/".$file))
398 $strError_tmp .=
"[".$err.
"] ".str_replace(
"#FILE#", $file,
GetMessage(
"SUPP_UU_NO_UFILE")).
".<br>";
401 if ($strError_tmp ==
'')
405 $strError_tmp .=
"[UUU08] ".GetMessage(
"SUPP_UU_LOAD_BREAK").
".<br>";
409 if ($strError_tmp ==
'')
411 $new_updatesys_version =
"";
412 if (isset(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
413 && is_array(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
414 && !empty(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
415 && isset(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"][0][
"@"][
"VERSION"]))
417 $new_updatesys_version = trim(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"][0][
"@"][
"VERSION"]);
420 if ($new_updatesys_version ==
'')
421 $strError_tmp .=
"[UUU080] ".GetMessage(
"SUPP_UU_NO_NEW_VER").
".<br>";
424 if ($strError_tmp ==
'')
429 if ($strError_tmp ==
'')
435 if ($strError_tmp <>
'')
455 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
459 if ($strError_tmp ==
'')
464 "&lang=".urlencode(
$lang).
465 "&UTYPES=".urlencode(
"S").
466 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
467 "&COUNT_ONLY=".urlencode(
"F").
469 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
470 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
471 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
473 "&CLIENT_PHPVER=".urlencode(phpversion()).
474 "&stable=".urlencode($stableVersionsOnly).
475 "&".CUpdateSystem::ModulesArray2Query($arClientModules,
"bitm_");
479 $stime = microtime(
true);
484 $strError_tmp .=
"[ULS01] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
487 if ($strError_tmp ==
'')
489 if (!($fp1 = fopen(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
"wb")))
490 $strError_tmp .=
"[ULS02] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates",
GetMessage(
"SUPP_RV_ER_TEMP_FILE")).
".<br>";
493 if ($strError_tmp ==
'')
495 if (!fwrite($fp1, $fcontent))
496 $strError_tmp .=
"[ULS03] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
GetMessage(
"SUPP_RV_WRT_TEMP_FILE")).
".<br>";
501 if ($strError_tmp ==
'')
503 $temporary_updates_dir =
"";
505 $strError_tmp .=
"[ULS04] ".GetMessage(
"SUPP_LS_LOAD_BREAK").
".<br>";
508 if ($strError_tmp ==
'')
510 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$temporary_updates_dir;
511 if (!file_exists($updates_dir_full.
"/update_info.xml") || !is_file($updates_dir_full.
"/update_info.xml"))
512 $strError_tmp .=
"[ULS05] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_ER_DESCR_FILE")).
".<br>";
515 if ($strError_tmp ==
'')
517 if (!is_readable($updates_dir_full.
"/update_info.xml"))
518 $strError_tmp .=
"[ULS06] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_READ_DESCR_FILE")).
".<br>";
521 if ($strError_tmp ==
'')
523 $content = file_get_contents($updates_dir_full.
"/update_info.xml");
526 if ($strError_tmp ==
'')
532 if ($strError_tmp ==
'')
534 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
535 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
536 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
540 if (
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"] <>
'')
541 $strError_tmp .=
"[".$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"@"][
"TYPE"].
"] ";
543 $strError_tmp .=
$arRes[
"DATA"][
"#"][
"ERROR"][
$i][
"#"].
".<br>";
548 if ($strError_tmp ==
'')
551 $strError_tmp .=
"[ULS07] ".GetMessage(
"SUPP_LS_LOAD_BREAK").
".<br>";
554 if ($strError_tmp ==
'')
556 foreach ($arClientModules as
$module_id => $version)
563 if (!file_exists($to_dir) || !is_dir($to_dir))
565 $strError_tmp1 .=
"[ULS08] ".str_replace(
"#MODULE#",
$module_id,
GetMessage(
"SUPP_LS_NO_MOD_CAT")).
".<br>";
567 elseif (!is_writable($to_dir))
569 $strError_tmp1 .=
"[ULS09] ".str_replace(
"#MODULE#",
$module_id,
GetMessage(
"SUPP_LS_WR_MOD_CAT")).
".<br>";
572 if (!file_exists($from_dir) || !is_dir($from_dir))
574 $strError_tmp1 .=
"[ULS10] ".str_replace(
"#MODULE#",
$module_id,
GetMessage(
"SUPP_LS_NO_SRC_MOD")).
".<br>";
576 elseif (!is_readable($from_dir))
578 $strError_tmp1 .=
"[ULS11] ".str_replace(
"#MODULE#",
$module_id,
GetMessage(
"SUPP_LS_RD_SRC_MOD")).
".<br>";
581 if ($strError_tmp1 ==
'')
586 if ($strError_tmp1 <>
'')
589 $strError_tmp .= $strError_tmp1;
598 if ($strError_tmp ==
'')
603 if ($strError_tmp <>
'')
625 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
633 if ($strError_tmp ==
'')
638 "&lang=".urlencode(
$lang).
639 "&UTYPES=".urlencode(
"MLH").
640 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
641 "&ALL_MODULES=".urlencode(
"Y").
642 "&TYPENC=".((defined(
"DEMO") && DEMO==
"Y") ?
"D" : ((defined(
"ENCODE") && ENCODE==
"Y") ?
"E" :
"F" )).
643 "&COUNT_ONLY=".urlencode(
"Y").
645 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
646 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
647 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
649 "&CLIENT_PHPVER=".urlencode(phpversion()).
650 "&stable=".urlencode($stableVersionsOnly).
651 "&".CUpdateSystem::ModulesArray2Query($arClientModules,
"bitm_").
652 "&".CUpdateSystem::ModulesArray2Query($arClientLanguages,
"bitl_").
653 "&".CUpdateSystem::ModulesArray2Query($arClientHelps,
"bith_");
657 $stime = microtime(
true);
662 if ($strError_tmp ==
'')
668 if ($strError_tmp ==
'')
670 if (isset(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
671 && is_array(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
672 && !empty(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"]))
677 if (isset(
$arRes[
"DATA"][
"#"][
"MODULES"])
678 && is_array(
$arRes[
"DATA"][
"#"][
"MODULES"])
679 && !empty(
$arRes[
"DATA"][
"#"][
"MODULES"]))
684 if (isset(
$arRes[
"DATA"][
"#"][
"LANGS"])
685 && is_array(
$arRes[
"DATA"][
"#"][
"LANGS"])
686 && !empty(
$arRes[
"DATA"][
"#"][
"LANGS"]))
691 if (isset(
$arRes[
"DATA"][
"#"][
"HELPS"])
692 && is_array(
$arRes[
"DATA"][
"#"][
"HELPS"])
693 && !empty(
$arRes[
"DATA"][
"#"][
"HELPS"]))
698 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
699 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
700 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
705 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
706 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
707 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
712 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
713 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
714 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
720 if ($strError_tmp ==
'')
725 $strError_tmp .=
"[UGAUT01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
729 if ($strError_tmp <>
'')
750 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
754 if ($strError_tmp ==
'')
759 "&lang=".urlencode(
$lang).
760 "&UTYPES=".urlencode(
"M").
761 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
762 "&ALL_MODULES=".urlencode(
"Y").
763 "&TYPENC=".((defined(
"DEMO") && DEMO==
"Y") ?
"D" : ((defined(
"ENCODE") && ENCODE==
"Y") ?
"E" :
"F" )).
764 "&COUNT_ONLY=".urlencode(
"N").
766 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
767 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
768 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
770 "&CLIENT_PHPVER=".urlencode(phpversion()).
771 "&stable=".urlencode($stableVersionsOnly).
772 "&".CUpdateSystem::ModulesArray2Query($arClientModules,
"bitm_");
776 $stime = microtime(
true);
781 if ($strError_tmp ==
'')
787 if ($strError_tmp ==
'')
789 if (isset(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
790 && is_array(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
791 && !empty(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"]))
796 if (isset(
$arRes[
"DATA"][
"#"][
"MODULES"])
797 && is_array(
$arRes[
"DATA"][
"#"][
"MODULES"])
798 && !empty(
$arRes[
"DATA"][
"#"][
"MODULES"]))
803 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
804 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
805 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
810 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
811 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
812 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
817 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
818 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
819 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
825 if ($strError_tmp ==
'')
830 $strError_tmp .=
"[UGSMU01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
834 if ($strError_tmp <>
'')
853 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
860 if ($strError_tmp ==
'')
865 "&lang=".urlencode(
$lang).
866 "&UTYPES=".urlencode(
"L").
867 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
868 "&ALL_MODULES=".urlencode(
"Y").
869 "&COUNT_ONLY=".urlencode(
"N").
870 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
873 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
874 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
875 "&CLIENT_PHPVER=".urlencode(phpversion()).
876 "&stable=".urlencode($stableVersionsOnly).
877 "&".CUpdateSystem::ModulesArray2Query($arClientLanguages,
"bitl_");
881 $stime = microtime(
true);
886 if ($strError_tmp ==
'')
892 if ($strError_tmp ==
'')
894 if (isset(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
895 && is_array(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
896 && !empty(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"]))
901 if (isset(
$arRes[
"DATA"][
"#"][
"LANGS"])
902 && is_array(
$arRes[
"DATA"][
"#"][
"LANGS"])
903 && !empty(
$arRes[
"DATA"][
"#"][
"LANGS"]))
908 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
909 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
910 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
915 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
916 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
917 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
922 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
923 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
924 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
930 if ($strError_tmp ==
'')
935 $strError_tmp .=
"[UGSLU01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
939 if ($strError_tmp <>
'')
958 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
965 if ($strError_tmp ==
'')
970 "&lang=".urlencode(
$lang).
971 "&UTYPES=".urlencode(
"H").
972 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
973 "&ALL_MODULES=".urlencode(
"Y").
974 "&COUNT_ONLY=".urlencode(
"N").
975 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
978 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
979 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
980 "&CLIENT_PHPVER=".urlencode(phpversion()).
981 "&stable=".urlencode($stableVersionsOnly).
982 "&".CUpdateSystem::ModulesArray2Query($arClientHelps,
"bith_");
986 $stime = microtime(
true);
991 if ($strError_tmp ==
'')
997 if ($strError_tmp ==
'')
999 if (isset(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
1000 && is_array(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"])
1001 && !empty(
$arRes[
"DATA"][
"#"][
"UPDATE_SYSTEM"]))
1006 if (isset(
$arRes[
"DATA"][
"#"][
"HELPS"])
1007 && is_array(
$arRes[
"DATA"][
"#"][
"HELPS"])
1008 && !empty(
$arRes[
"DATA"][
"#"][
"HELPS"]))
1013 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
1014 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
1015 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
1020 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
1021 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
1022 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
1027 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
1028 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
1029 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
1035 if ($strError_tmp ==
'')
1040 $strError_tmp .=
"[UGSHU01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
1044 if ($strError_tmp <>
'')
1063 $lang = LANGUAGE_ID;
1065 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
1067 if (!is_array($arModules))
1069 $strError_tmp .=
"[ULMU01] ".GetMessage(
"SUPP_LMU_NO_MODS").
".<br>";
1072 if ($strError_tmp ==
'')
1077 if (!array_key_exists($arModules[
$i], $arClientModules))
1078 $arClientModules[$arModules[
$i]] =
"";
1080 if (!is_array($arClientModules) || empty($arClientModules))
1082 $strError_tmp .=
"[ULMU02] ".GetMessage(
"SUPP_LMU_NO_MODS").
".<br>";
1086 if ($strError_tmp ==
'')
1091 "&lang=".urlencode(
$lang).
1092 "&UTYPES=".urlencode(
"M").
1093 "&ALL_MODULES=".urlencode(
"N").
1094 "&TYPENC=".((defined(
"DEMO") && DEMO==
"Y") ?
"D" : ((defined(
"ENCODE") && ENCODE==
"Y") ?
"E" :
"F" )).
1095 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
1096 "&COUNT_ONLY=".urlencode(
"F").
1097 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
1100 "&CLIENT_PHPVER=".urlencode(phpversion()).
1101 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
1102 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
1103 "&stable=".urlencode($stableVersionsOnly).
1104 "&".CUpdateSystem::ModulesArray2Query($arClientModules,
"bitm_");
1108 $stime = microtime(
true);
1113 $strError_tmp .=
"[ULMU03] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
1116 if ($strError_tmp ==
'')
1118 if (!($fp1 = fopen(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
"wb")))
1120 $strError_tmp .=
"[ULMU04] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates",
GetMessage(
"SUPP_RV_ER_TEMP_FILE")).
".<br>";
1124 if ($strError_tmp ==
'')
1129 if (!file_exists(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz")
1130 || !is_file(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz"))
1132 $strError_tmp .=
"[ULMU05] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
GetMessage(
"SUPP_LMU_NO_TMP_FILE")).
".<br>";
1136 if ($strError_tmp <>
'')
1154 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
1157 $lang = LANGUAGE_ID;
1161 $strError_tmp .=
"[ULLU01] ".GetMessage(
"SUPP_LLU_NO_LANGS").
".<br>";
1164 if ($strError_tmp ==
'')
1169 if (!array_key_exists(
$arLangs[
$i], $arClientLangs))
1172 if (!is_array($arClientLangs) || empty($arClientLangs))
1174 $strError_tmp .=
"[ULLU02] ".GetMessage(
"SUPP_LLU_NO_LANGS").
".<br>";
1178 if ($strError_tmp ==
'')
1183 "&lang=".urlencode(
$lang).
1184 "&UTYPES=".urlencode(
"L").
1185 "&ALL_MODULES=".urlencode(
"N").
1186 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
1188 "&COUNT_ONLY=".urlencode(
"F").
1189 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
1191 "&CLIENT_PHPVER=".urlencode(phpversion()).
1192 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
1193 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
1194 "&stable=".urlencode($stableVersionsOnly).
1195 "&".CUpdateSystem::ModulesArray2Query($arClientLangs,
"bitl_");
1199 $stime = microtime(
true);
1204 $strError_tmp .=
"[ULLU03] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
1207 if ($strError_tmp ==
'')
1209 if (!($fp1 = fopen(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
"wb")))
1211 $strError_tmp .=
"[ULLU04] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates",
GetMessage(
"SUPP_RV_ER_TEMP_FILE")).
".<br>";
1215 if ($strError_tmp ==
'')
1220 if (!file_exists(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz")
1221 || !is_file(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz"))
1223 $strError_tmp .=
"[ULLU05] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
GetMessage(
"SUPP_LMU_NO_TMP_FILE")).
".<br>";
1227 if ($strError_tmp <>
'')
1246 $lang = LANGUAGE_ID;
1248 $stableVersionsOnly = (($stableVersionsOnly ==
"N") ?
"N" :
"Y");
1250 if (!is_array($arHelp) || empty($arHelp))
1252 $strError_tmp .=
"[ULHU01] ".GetMessage(
"SUPP_LHU_NO_HELP").
".<br>";
1255 if ($strError_tmp ==
'')
1260 if (!array_key_exists($arHelp[
$i], $arClientHelps))
1261 $arClientHelps[$arHelp[
$i]] =
"";
1264 if (!is_array($arClientHelps) || empty($arClientHelps))
1266 $strError_tmp .=
"[ULHU02] ".GetMessage(
"SUPP_LHU_NO_HELP").
".<br>";
1270 if ($strError_tmp ==
'')
1275 "&lang=".urlencode(
$lang).
1276 "&UTYPES=".urlencode(
"H").
1277 "&ALL_MODULES=".urlencode(
"N").
1278 "&SUPD_VER=".urlencode(UPDATE_SYSTEM_VERSION).
1280 "&COUNT_ONLY=".urlencode(
"F").
1281 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
1283 "&CLIENT_PHPVER=".urlencode(phpversion()).
1284 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
1285 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
1286 "&stable=".urlencode($stableVersionsOnly).
1287 "&".CUpdateSystem::ModulesArray2Query($arClientHelps,
"bith_");
1291 $stime = microtime(
true);
1296 $strError_tmp .=
"[ULHU03] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
1299 if ($strError_tmp ==
'')
1301 if (!($fp1 = fopen(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
"wb")))
1302 $strError_tmp .=
"[ULHU04] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates",
GetMessage(
"SUPP_RV_ER_TEMP_FILE")).
".<br>";
1305 if ($strError_tmp ==
'')
1310 if (!file_exists(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz")
1311 || !is_file(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz"))
1313 $strError_tmp .=
"[ULHU05] ".str_replace(
"#FILE#",
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz",
GetMessage(
"SUPP_LMU_NO_TMP_FILE")).
".<br>";
1317 if ($strError_tmp <>
'')
1333 $stime = microtime(
true);
1338 $archiveFileName =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/update_archive.gz";
1340 if (!file_exists($archiveFileName) || !is_file($archiveFileName))
1342 $strError_tmp .=
"[UUGZA01] ".str_replace(
"#FILE#", $archiveFileName,
GetMessage(
"SUPP_UGA_NO_TMP_FILE")).
".<br>";
1345 if ($strError_tmp ==
'')
1347 if (!is_readable($archiveFileName))
1348 $strError_tmp .=
"[UUGZA02] ".str_replace(
"#FILE#", $archiveFileName,
GetMessage(
"SUPP_UGA_NO_READ_FILE")).
".<br>";
1351 if ($strError_tmp ==
'')
1353 $updates_dir =
"update_m".time();
1354 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
1357 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
1359 $strError_tmp .=
"[UUGZA03] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_UGA_NO_TMP_CAT")).
".<br>";
1361 elseif (!is_writable($updates_dir_full))
1363 $strError_tmp .=
"[UUGZA04] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_UGA_WRT_TMP_CAT")).
".<br>";
1367 if ($strError_tmp ==
'')
1369 $bCompressionUsed =
true;
1371 $fd = fopen($archiveFileName,
"rb");
1372 $flabel = fread($fd, strlen(
"BITRIX"));
1375 if ($flabel==
"BITRIX")
1376 $bCompressionUsed =
false;
1379 if ($strError_tmp ==
'')
1381 if ($bCompressionUsed)
1382 $zp = gzopen($archiveFileName,
"rb9f");
1384 $zp = fopen($archiveFileName,
"rb");
1388 $strError_tmp .=
"[UUGZA05] ".str_replace(
"#FILE#", $archiveFileName,
GetMessage(
"SUPP_UGA_CANT_OPEN")).
".<br>";
1392 if ($strError_tmp ==
'')
1394 if ($bCompressionUsed)
1395 $flabel = gzread($zp, strlen(
"BITRIX"));
1397 $flabel = fread($zp, strlen(
"BITRIX"));
1399 if ($flabel!=
"BITRIX")
1401 $strError_tmp .=
"[UUGZA06] ".str_replace(
"#FILE#", $archiveFileName,
GetMessage(
"SUPP_UGA_BAD_FORMAT")).
".<br>";
1403 if ($bCompressionUsed)
1410 if ($strError_tmp ==
'')
1412 $strongUpdateCheck = COption::GetOptionString(
"main",
"strong_update_check",
"Y");
1416 if ($bCompressionUsed)
1417 $add_info_size = gzread($zp, 5);
1419 $add_info_size = fread($zp, 5);
1421 $add_info_size = trim($add_info_size);
1422 if (intval($add_info_size)>0
1423 && intval($add_info_size).
"!"==$add_info_size.
"!")
1425 $add_info_size = intval($add_info_size);
1429 if ($add_info_size!=
"RTIBE")
1430 $strError_tmp .=
"[UUGZA071] ".str_replace(
"#FILE#", $archiveFileName,
GetMessage(
"SUPP_UGA_BAD_FORMAT")).
".<br>";
1435 if ($bCompressionUsed)
1436 $add_info = gzread($zp, $add_info_size);
1438 $add_info = fread($zp, $add_info_size);
1440 $add_info_arr = explode(
"|", $add_info);
1441 if (
count($add_info_arr) != 3)
1443 $strError_tmp .=
"[UUGZA072] ".str_replace(
"#FILE#", $archiveFileName,
GetMessage(
"SUPP_UGA_BAD_FORMAT")).
".<br>";
1447 $size = $add_info_arr[0];
1448 $curpath = $add_info_arr[1];
1449 $crc32 = $add_info_arr[2];
1452 if (intval($size) > 0)
1454 if ($bCompressionUsed)
1462 if ($crc32_new !== $crc32)
1464 $strError_tmp .=
"[UUGZA073] ".str_replace(
"#FILE#", $curpath,
GetMessage(
"SUPP_UGA_FILE_CRUSH")).
".<br>";
1471 if (!($fp1 = fopen($updates_dir_full.$curpath,
"wb")))
1473 $strError_tmp .=
"[UUGZA074] ".str_replace(
"#FILE#", $updates_dir_full.$curpath,
GetMessage(
"SUPP_UGA_CANT_OPEN_WR")).
".<br>";
1479 $strError_tmp .=
"[UUGZA075] ".str_replace(
"#FILE#", $updates_dir_full.$curpath,
GetMessage(
"SUPP_UGA_CANT_WRITE_F")).
".<br>";
1485 if ($strongUpdateCheck ==
"Y")
1487 $crc32_new = dechex(crc32(file_get_contents($updates_dir_full.$curpath)));
1488 if ($crc32_new !== $crc32)
1490 $strError_tmp .=
"[UUGZA0761] ".str_replace(
"#FILE#", $curpath,
GetMessage(
"SUPP_UGA_FILE_CRUSH")).
".<br>";
1497 if ($bCompressionUsed)
1503 if ($strError_tmp ==
'')
1506 @unlink($archiveFileName);
1511 if ($strError_tmp <>
'')
1528 $stime = microtime(
true);
1531 || !isset(
$arRes[
"MODULES"])
1532 || !is_array(
$arRes[
"MODULES"])
1535 $strError_tmp .=
"[UCV01] ".GetMessage(
"SUPP_CV_ERR_ARR").
".<br>";
1538 if ($arSelectedModules!==
false && (!is_array($arSelectedModules) || empty($arSelectedModules)))
1540 $strError_tmp .=
"[UCV011] ".GetMessage(
"SUPP_CV_NO_SELECTED").
".<br>";
1543 if ($strError_tmp ==
'')
1545 $arModulesList =
$arRes[
"MODULES"][
"#"][
"MODULE"];
1547 if (!is_array($arModulesList) || empty($arModulesList))
1549 $strError_tmp .=
"[UCV02] ".GetMessage(
"SUPP_CV_EMPTY_MODS").
".<br>";
1553 if ($strError_tmp ==
'')
1555 for (
$i = 0, $ni =
count($arModulesList);
$i < $ni;
$i++)
1557 if ($arSelectedModules===
false || in_array($arModulesList[
$i][
"@"][
"ID"], $arSelectedModules))
1559 if (isset($arModulesList[
$i][
"#"][
"VERSION_CONTROL"])
1560 && !empty($arModulesList[
$i][
"#"][
"VERSION_CONTROL"]))
1562 for ($j = 0, $nj =
count($arModulesList[
$i][
"#"][
"VERSION_CONTROL"]); $j < $nj; $j++)
1564 $strModule_tmp = $arModulesList[
$i][
"#"][
"VERSION_CONTROL"][$j][
"@"][
"MODUL"];
1565 $bNeedInstall =
true;
1567 for (
$k = 0, $nk =
count($arModulesList);
$k < $nk;
$k++)
1569 if ($arModulesList[
$k][
"@"][
"ID"]==$strModule_tmp
1570 && ($arSelectedModules===
false
1571 || in_array($arModulesList[
$k][
"@"][
"ID"], $arSelectedModules)))
1574 $arModulesList[
$k][
"@"][
"VERSION"],
1575 $arModulesList[
$i][
"#"][
"VERSION_CONTROL"][$j][
"@"][
"VERSION"]
1578 $bNeedInstall =
false;
1586 $strModule_tmp_dir =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/".$strModule_tmp;
1587 if (file_exists($strModule_tmp_dir) && is_dir($strModule_tmp_dir))
1589 if ($strModule_tmp!=
"main")
1591 if (file_exists($strModule_tmp_dir.
"/install/index.php"))
1595 $arModule_tmp_info[
"VERSION"],
1596 $arModulesList[
$i][
"#"][
"VERSION_CONTROL"][$j][
"@"][
"VERSION"]
1599 $bNeedInstall =
false;
1607 $arModulesList[
$i][
"#"][
"VERSION_CONTROL"][$j][
"@"][
"VERSION"]
1610 $bNeedInstall =
false;
1616 $bNeedInstall =
false;
1622 $strError_tmp .=
"[UCV_MER01] ".str_replace(
"#VERS#", $arModulesList[
$i][
"#"][
"VERSION_CONTROL"][$j][
"@"][
"VERSION"], str_replace(
"#MODULE2#", $strModule_tmp, str_replace(
"#MODULE1#", $arModulesList[
$i][
"@"][
"ID"],
GetMessage(
"SUPP_CV_RES_ERR")))).
".<br>";
1632 if ($strError_tmp <>
'')
1648 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
1649 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
1651 $strError_tmp .=
"[UCU01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
1654 if ($strError_tmp ==
'')
1656 if (!is_readable($updates_dir_full))
1658 $strError_tmp .=
"[UCU02] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
1662 if (
$handle = @opendir($updates_dir_full))
1664 while (($file = readdir(
$handle)) !==
false)
1666 if ($file ==
"." || $file ==
"..")
continue;
1668 if (is_dir($updates_dir_full.
"/".$file))
1672 elseif (is_file($updates_dir_full.
"/".$file))
1674 $strRealPath =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/".substr($updates_dir.
"/".$file, strpos($updates_dir.
"/".$file,
"/"));
1675 if (file_exists($strRealPath))
1677 if (!is_writeable($strRealPath))
1679 $strError_tmp .=
"[UCU03] ".str_replace(
"#FILE#", $strRealPath,
GetMessage(
"SUPP_CU_MAIN_ERR_FILE")).
".<br>";
1685 $strRealPath = substr($strRealPath, 0,
$p);
1687 if (strlen($strRealPath)>1)
1688 $strRealPath = rtrim($strRealPath,
"/");
1693 if (file_exists($strRealPath) && is_dir($strRealPath))
1695 if (!is_writable($strRealPath))
1696 $strError_tmp .=
"[UCU04] ".str_replace(
"#FILE#", $strRealPath,
GetMessage(
"SUPP_CU_MAIN_ERR_CAT")).
".<br>";
1700 $strRealPath = substr($strRealPath, 0,
$p);
1709 if ($strError_tmp <>
'')
1723 $destFolder = str_replace(
"\\",
"/", $destFolder);
1724 $destFolder = trim($destFolder,
" \t\n\r\0\x0B/\\");
1725 if ($destFolder <>
'')
1726 $destFolder =
"/".$destFolder;
1728 if ($srcFolder && $srcFolder <>
'')
1730 $srcFolder = str_replace(
"\\",
"/", $srcFolder);
1731 $srcFolder = trim($srcFolder,
" \t\n\r\0\x0B/\\");
1732 if ($srcFolder <>
'')
1733 $srcFolder =
"/".$srcFolder;
1735 $srcFolderFull =
$_SERVER[
"DOCUMENT_ROOT"].$srcFolder;
1736 if (!file_exists($srcFolderFull) || !is_dir($srcFolderFull))
1737 $strError_tmp .=
"[UCFU01] ".str_replace(
"#FILE#", $srcFolderFull,
GetMessage(
"SUPN_NO_FOLDER_EX")).
".<br>";
1739 if ($strError_tmp ==
'')
1741 if (!is_readable($srcFolderFull))
1742 $strError_tmp .=
"[UCFU02] ".str_replace(
"#FILE#", $srcFolderFull,
GetMessage(
"SUPN_CU_RD_TMP_CAT")).
".<br>";
1745 if (
$handle = @opendir($srcFolderFull))
1747 while (($file = readdir(
$handle)) !==
false)
1749 if ($file ==
"." || $file ==
"..")
1752 if (is_dir($srcFolderFull.
"/".$file))
1756 elseif (is_file($srcFolderFull.
"/".$file))
1758 $destFileFull =
$_SERVER[
"DOCUMENT_ROOT"].$destFolder.
"/".$file;
1759 if (file_exists($destFileFull))
1761 if (!is_writeable($destFileFull))
1762 $strError_tmp .=
"[UCFU03] ".str_replace(
"#FILE#", $destFileFull,
GetMessage(
"SUPP_CU_MAIN_ERR_FILE")).
".<br>";
1767 $destFileFull = substr($destFileFull, 0,
$p);
1769 while (strlen($destFileFull) > 1 && substr($destFileFull, strlen($destFileFull) - 1, 1) ==
"/")
1770 $destFileFull = substr($destFileFull, 0, strlen($destFileFull) - 1);
1775 if (file_exists($destFileFull) && is_dir($destFileFull))
1777 if (!is_writable($destFileFull))
1778 $strError_tmp .=
"[UCFU04] ".str_replace(
"#FILE#", $destFileFull,
GetMessage(
"SUPP_CU_MAIN_ERR_CAT")).
".<br>";
1782 $destFileFull = substr($destFileFull, 0,
$p);
1793 $destFolderFull =
$_SERVER[
"DOCUMENT_ROOT"].$destFolder;
1794 if (!file_exists($destFolderFull) || !is_dir($destFolderFull))
1795 $strError_tmp .=
"[UCFU05] ".str_replace(
"#FILE#", $destFolderFull,
GetMessage(
"SUPN_NO_FOLDER_EX")).
".<br>";
1797 if ($strError_tmp ==
'')
1799 if (!is_writeable($destFolderFull))
1800 $strError_tmp .=
"[UCFU06] ".str_replace(
"#FILE#", $destFolderFull,
GetMessage(
"SUPP_CU_MAIN_ERR_CAT")).
".<br>";
1803 if (
$handle = @opendir($destFolderFull))
1805 while (($file = readdir(
$handle)) !==
false)
1807 if ($file ==
"." || $file ==
"..")
1810 if (is_dir($destFolderFull.
"/".$file))
1814 elseif (is_file($destFolderFull.
"/".$file))
1816 if (!is_writeable($destFolderFull.
"/".$file))
1817 $strError_tmp .=
"[UCFU07] ".str_replace(
"#FILE#", $destFolderFull.
"/".$file,
GetMessage(
"SUPP_CU_MAIN_ERR_FILE")).
".<br>";
1824 if ($strError_tmp <>
'')
1843 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
1844 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
1846 $strError_tmp .=
"[UGLMU01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
1849 if ($strError_tmp ==
'')
1851 if (!is_readable($updates_dir_full))
1852 $strError_tmp .=
"[UGLMU02] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
1855 if ($strError_tmp ==
'')
1857 if (!file_exists($updates_dir_full.
"/update_info.xml") || !is_file($updates_dir_full.
"/update_info.xml"))
1859 $strError_tmp .=
"[UGLMU03] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_ER_DESCR_FILE")).
".<br>";
1863 if ($strError_tmp ==
'')
1865 if (!is_readable($updates_dir_full.
"/update_info.xml"))
1866 $strError_tmp .=
"[UGLMU04] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_READ_DESCR_FILE")).
".<br>";
1869 if ($strError_tmp ==
'')
1871 $content = file_get_contents($updates_dir_full.
"/update_info.xml");
1874 if ($strError_tmp ==
'')
1880 if ($strError_tmp ==
'')
1882 if (isset(
$arRes[
"DATA"][
"#"][
"MODULES"])
1883 && is_array(
$arRes[
"DATA"][
"#"][
"MODULES"])
1884 && !empty(
$arRes[
"DATA"][
"#"][
"MODULES"]))
1889 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
1890 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
1891 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
1896 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
1897 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
1898 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
1903 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
1904 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
1905 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
1911 if ($strError_tmp ==
'')
1916 $strError_tmp .=
"[UGSMU01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
1920 if ($strError_tmp <>
'')
1939 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
1940 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
1942 $strError_tmp .=
"[UGLLU01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
1945 if ($strError_tmp ==
'')
1947 if (!is_readable($updates_dir_full))
1948 $strError_tmp .=
"[UGLLU02] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
1951 if ($strError_tmp ==
'')
1953 if (!file_exists($updates_dir_full.
"/update_info.xml") || !is_file($updates_dir_full.
"/update_info.xml"))
1955 $strError_tmp .=
"[UGLLU03] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_ER_DESCR_FILE")).
".<br>";
1959 if ($strError_tmp ==
'')
1961 if (!is_readable($updates_dir_full.
"/update_info.xml"))
1962 $strError_tmp .=
"[UGLLU04] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_READ_DESCR_FILE")).
".<br>";
1965 if ($strError_tmp ==
'')
1967 $content = file_get_contents($updates_dir_full.
"/update_info.xml");
1970 if ($strError_tmp ==
'')
1976 if ($strError_tmp ==
'')
1978 if (isset(
$arRes[
"DATA"][
"#"][
"LANGS"])
1979 && is_array(
$arRes[
"DATA"][
"#"][
"LANGS"])
1980 && !empty(
$arRes[
"DATA"][
"#"][
"LANGS"]))
1985 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
1986 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
1987 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
1992 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
1993 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
1994 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
1999 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
2000 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
2001 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
2007 if ($strError_tmp ==
'')
2012 $strError_tmp .=
"[UGSLU01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
2016 if ($strError_tmp <>
'')
2034 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
2035 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
2037 $strError_tmp .=
"[UGLHU01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
2040 if ($strError_tmp ==
'')
2042 if (!is_readable($updates_dir_full))
2043 $strError_tmp .=
"[UGLHU02] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
2046 if ($strError_tmp ==
'')
2048 if (!file_exists($updates_dir_full.
"/update_info.xml") || !is_file($updates_dir_full.
"/update_info.xml"))
2050 $strError_tmp .=
"[UGLHU03] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_ER_DESCR_FILE")).
".<br>";
2054 if ($strError_tmp ==
'')
2056 if (!is_readable($updates_dir_full.
"/update_info.xml"))
2057 $strError_tmp .=
"[UGLHU04] ".str_replace(
"#FILE#", $updates_dir_full.
"/update_info.xml",
GetMessage(
"SUPP_RV_READ_DESCR_FILE")).
".<br>";
2060 if ($strError_tmp ==
'')
2062 $content = file_get_contents($updates_dir_full.
"/update_info.xml");
2065 if ($strError_tmp ==
'')
2071 if ($strError_tmp ==
'')
2073 if (isset(
$arRes[
"DATA"][
"#"][
"HELPS"])
2074 && is_array(
$arRes[
"DATA"][
"#"][
"HELPS"])
2075 && !empty(
$arRes[
"DATA"][
"#"][
"HELPS"]))
2080 if (isset(
$arRes[
"DATA"][
"#"][
"ERROR"])
2081 && is_array(
$arRes[
"DATA"][
"#"][
"ERROR"])
2082 && !empty(
$arRes[
"DATA"][
"#"][
"ERROR"]))
2087 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"])
2088 && is_array(
$arRes[
"DATA"][
"#"][
"CLIENT"])
2089 && !empty(
$arRes[
"DATA"][
"#"][
"CLIENT"]))
2094 if (isset(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
2095 && is_array(
$arRes[
"DATA"][
"#"][
"SYSTEM"])
2096 && !empty(
$arRes[
"DATA"][
"#"][
"SYSTEM"]))
2102 if ($strError_tmp ==
'')
2107 $strError_tmp .=
"[UGSHU01] ".GetMessage(
"SUPP_GAUT_SYSERR").
".<br>";
2111 if ($strError_tmp <>
'')
2128 $stime = microtime(
true);
2130 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
2132 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
2134 $strError_tmp .=
"[UUK01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
2137 if (!is_array($arModules) || empty($arModules))
2139 $strError_tmp .=
"[UUK02] ".GetMessage(
"SUPP_UK_NO_MODS").
".<br>";
2142 if ($strError_tmp ==
'')
2144 if (!is_readable($updates_dir_full))
2145 $strError_tmp .=
"[UUK03] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
2148 if ($strError_tmp ==
'')
2150 for (
$i = 0, $ni =
count($arModules);
$i < $ni;
$i++)
2152 $strError_tmp1 =
"";
2154 $from_dir = $updates_dir_full.
"/".$arModules[
$i];
2155 $to_dir =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/".$arModules[
$i];
2159 if (!file_exists($to_dir) || !is_dir($to_dir))
2161 $strError_tmp1 .=
"[UUK04] ".str_replace(
"#MODULE_DIR#", $to_dir,
GetMessage(
"SUPP_UK_NO_MODIR")).
".<br>";
2162 $arErrorModules[$arModules[
$i]] = str_replace(
"#MODULE_DIR#", $to_dir,
GetMessage(
"SUPP_UK_NO_MODIR")).
" [UUK04]. ";
2165 if ($strError_tmp1 ==
'')
2167 if (!is_writable($to_dir))
2169 $strError_tmp1 .=
"[UUK05] ".str_replace(
"#MODULE_DIR#", $to_dir,
GetMessage(
"SUPP_UK_WR_MODIR")).
".<br>";
2170 $arErrorModules[$arModules[
$i]] = str_replace(
"#MODULE_DIR#", $to_dir,
GetMessage(
"SUPP_UK_WR_MODIR")).
" [UUK05]. ";
2174 if ($strError_tmp1 ==
'')
2176 if (!file_exists($from_dir) || !is_dir($from_dir))
2178 $strError_tmp1 .=
"[UUK06] ".str_replace(
"#DIR#", $from_dir,
GetMessage(
"SUPP_UK_NO_FDIR")).
".<br>";
2179 $arErrorModules[$arModules[
$i]] = str_replace(
"#DIR#", $from_dir,
GetMessage(
"SUPP_UK_NO_FDIR")).
" [UUK06]. ";
2183 if ($strError_tmp1 ==
'')
2185 if (!is_readable($from_dir))
2187 $strError_tmp1 .=
"[UUK07] ".str_replace(
"#DIR#", $from_dir,
GetMessage(
"SUPP_UK_READ_FDIR")).
".<br>";
2188 $arErrorModules[$arModules[
$i]] = str_replace(
"#DIR#", $from_dir,
GetMessage(
"SUPP_UK_READ_FDIR")).
" [UUK07]. ";
2192 if ($strError_tmp1 ==
'')
2194 $handle = @opendir($from_dir);
2195 $arUpdaters =
array();
2200 if (substr(
$dir, 0, 7)==
"updater")
2202 $bPostUpdater =
"N";
2203 if (is_file($from_dir.
"/".
$dir))
2205 $num = substr(
$dir, 7, strlen(
$dir)-11);
2206 if (substr(
$dir, strlen(
$dir) - 9) ==
"_post.php")
2208 $bPostUpdater =
"Y";
2209 $num = substr(
$dir, 7, strlen(
$dir)-16);
2211 $arUpdaters[] =
array(
"/".
$dir, trim($num), $bPostUpdater);
2213 elseif (file_exists($from_dir.
"/".
$dir.
"/index.php"))
2215 $num = substr(
$dir, 7);
2216 if (substr(
$dir, strlen(
$dir) - 5) ==
"_post")
2218 $bPostUpdater =
"Y";
2219 $num = substr(
$dir, 7, strlen(
$dir)-12);
2221 $arUpdaters[] =
array(
"/".
$dir.
"/index.php", trim($num), $bPostUpdater);
2228 for ($i1 = 0, $nij =
count($arUpdaters); $i1 < $nij-1; $i1++)
2230 for ($j1 = $i1 + 1; $j1 < $nij; $j1++)
2234 $tmp1 = $arUpdaters[$i1];
2235 $arUpdaters[$i1] = $arUpdaters[$j1];
2236 $arUpdaters[$j1] = $tmp1;
2242 if ($strError_tmp1 ==
'')
2244 if (strtolower(
$DB->type)==
"mysql" && defined(
"MYSQL_TABLE_TYPE") && MYSQL_TABLE_TYPE <>
'')
2246 $DB->Query(
"SET storage_engine = '".MYSQL_TABLE_TYPE.
"'",
true);
2250 if ($strError_tmp1 ==
'')
2252 for ($i1 = 0, $ni1 =
count($arUpdaters); $i1 < $ni1; $i1++)
2254 if ($arUpdaters[$i1][2]==
"N")
2256 $strError_tmp2 =
"";
2258 if ($strError_tmp2 <>
'')
2261 str_replace(
"#MODULE#", $arModules[
$i], str_replace(
"#VER#", $arUpdaters[$i1][1],
GetMessage(
"SUPP_UK_UPDN_ERR"))).
": ".
2262 $strError_tmp2.
".<br>";
2263 $arErrorModules[$arModules[
$i]] =
2264 str_replace(
"#MODULE#", $arModules[
$i], str_replace(
"#VER#", $arUpdaters[$i1][1],
GetMessage(
"SUPP_UK_UPDN_ERR"))).
": ".
2265 $strError_tmp2.
".<br>";
2266 $strError_tmp1 .= str_replace(
"#MODULE#", $arModules[
$i],
GetMessage(
"SUPP_UK_UPDN_ERR_BREAK")).
" ";
2273 if ($strError_tmp1 ==
'')
2278 if ($strError_tmp1 ==
'')
2280 for ($i1 = 0, $ni1 =
count($arUpdaters); $i1 < $ni1; $i1++)
2282 if ($arUpdaters[$i1][2]==
"Y")
2284 $strError_tmp2 =
"";
2286 if ($strError_tmp2 <>
'')
2289 str_replace(
"#MODULE#", $arModules[
$i], str_replace(
"#VER#", $arUpdaters[$i1][1],
GetMessage(
"SUPP_UK_UPDY_ERR"))).
": ".
2290 $strError_tmp2.
".<br>";
2291 $arErrorModules[$arModules[
$i]] =
2292 str_replace(
"#MODULE#", $arModules[
$i], str_replace(
"#VER#", $arUpdaters[$i1][1],
GetMessage(
"SUPP_UK_UPDY_ERR"))).
": ".
2293 $strError_tmp2.
".<br>";
2294 $strError_tmp1 .= str_replace(
"#MODULE#", $arModules[
$i],
GetMessage(
"SUPP_UK_UPDN_ERR_BREAK")).
" ";
2301 if ($strError_tmp1 <>
'')
2303 $strError_tmp .= $strError_tmp1;
2304 $arErrorModules[$arModules[
$i]] .= str_replace(
"#MODULE#", $arModules[
$i],
GetMessage(
"SUPP_UK_UPDN_ERR_BREAK1")).
" ";
2308 $arSuccessModules[$arModules[
$i]] =
"Y";
2316 if ($strError_tmp <>
'')
2333 $stime = microtime(
true);
2335 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
2337 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
2339 $strError_tmp .=
"[UUL01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
2344 $strError_tmp .=
"[UUL02] ".GetMessage(
"SUPP_UL_NO_LANGS").
".<br>";
2347 if ($strError_tmp ==
'')
2349 if (!is_readable($updates_dir_full))
2350 $strError_tmp .=
"[UUL03] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
2353 if ($strError_tmp ==
'')
2355 $to_dir1 =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/components/bitrix";
2359 if (file_exists($to_dir1) && is_dir($to_dir1))
2361 if (!is_writable($to_dir1))
2362 $strError_tmp .=
"[UUL0511] ".str_replace(
"#FILE#", $to_dir1,
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2366 if ($strError_tmp ==
'')
2368 $to_dir =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules";
2372 if (!file_exists($to_dir) || !is_dir($to_dir))
2374 $strError_tmp .=
"[UUL04] ".str_replace(
"#FILE#", $to_dir,
GetMessage(
"SUPP_UL_CAT")).
".<br>";
2376 elseif (!is_writable($to_dir))
2378 $strError_tmp .=
"[UUL05] ".str_replace(
"#FILE#", $to_dir,
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2382 if ($strError_tmp ==
'')
2384 $arLangModules1 =
array();
2385 $arLangModules2 =
array();
2386 $handle1 = @opendir($to_dir1);
2389 while (
false !== ($dir1 = readdir($handle1)))
2391 if (is_dir($to_dir1.
"/".$dir1) && $dir1 !=
"." && $dir1 !=
"..")
2393 if (!is_writable($to_dir1.
"/".$dir1))
2394 $strError_tmp .=
"[UUL051] ".str_replace(
"#FILE#", $to_dir1.
"/".$dir1,
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2396 if (file_exists($to_dir1.
"/".$dir1.
"/lang")
2397 && !is_writable($to_dir1.
"/".$dir1.
"/lang"))
2398 $strError_tmp .=
"[UUL052] ".str_replace(
"#FILE#", $to_dir1.
"/".$dir1.
"/lang",
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2400 $arLangModules1[] = $dir1;
2402 $handle2 = @opendir($to_dir1.
"/".$dir1.
"/templates");
2405 while (
false !== ($dir2 = readdir($handle2)))
2407 if (is_dir($to_dir1.
"/".$dir1.
"/templates/".$dir2) && $dir2 !=
"." && $dir2 !=
"..")
2409 if (!is_writable($to_dir1.
"/".$dir1.
"/templates/".$dir2))
2410 $strError_tmp .=
"[UUL05111] ".str_replace(
"#FILE#", $to_dir1.
"/".$dir1.
"/templates/".$dir2,
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2412 if (file_exists($to_dir1.
"/".$dir1.
"/templates/".$dir2.
"/lang")
2413 && !is_writable($to_dir1.
"/".$dir1.
"/templates/".$dir2.
"/lang"))
2414 $strError_tmp .=
"[UUL05211] ".str_replace(
"#FILE#", $to_dir1.
"/".$dir1.
"/templates/".$dir2.
"/lang",
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2416 $arLangModules2[] = $dir1.
"@".$dir2;
2427 if ($strError_tmp ==
'')
2429 $arLangModules =
array();
2435 if (is_dir($to_dir.
"/".
$dir) &&
$dir!=
"." &&
$dir!=
"..")
2437 if (!is_writable($to_dir.
"/".
$dir))
2438 $strError_tmp .=
"[UUL051] ".str_replace(
"#FILE#", $to_dir.
"/".
$dir,
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2440 if (file_exists($to_dir.
"/".
$dir.
"/lang")
2441 && !is_writable($to_dir.
"/".
$dir.
"/lang"))
2442 $strError_tmp .=
"[UUL052] ".str_replace(
"#FILE#", $to_dir.
"/".
$dir.
"/lang",
GetMessage(
"SUPP_UL_NO_WRT_CAT")).
".<br>";
2444 $arLangModules[] =
$dir;
2452 if ($strError_tmp ==
'')
2456 $strError_tmp1 =
"";
2458 $from_dir = $updates_dir_full.
"/".
$arLangs[
$i];
2460 if (!file_exists($from_dir) || !is_dir($from_dir))
2462 $strError_tmp1 .=
"[UUL06] ".str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_TMP_LANG")).
".<br>";
2463 $arErrorLangs[
$arLangs[
$i]] = str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_TMP_LANG")).
" [UUL06]. ";
2466 if ($strError_tmp1 ==
'')
2468 if (!is_readable($from_dir))
2470 $strError_tmp1 .=
"[UUL07] ".str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_READ_LANG")).
".<br>";
2471 $arErrorLangs[
$arLangs[
$i]] = str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_READ_LANG")).
" [UUL07]. ";
2475 if ($strError_tmp1 ==
'')
2477 $handle1 = @opendir($from_dir.
"/__components");
2480 while (
false !== ($dir1 = readdir($handle1)))
2482 if (is_dir($from_dir.
"/__components/".$dir1) && $dir1 !=
"." && $dir1 !=
"..")
2484 if (file_exists($from_dir.
"/__components/".$dir1.
"/lang") && in_array($dir1, $arLangModules1))
2487 $handle2 = @opendir($from_dir.
"/__components/".$dir1.
"/templates");
2490 while (
false !== ($dir2 = readdir($handle2)))
2492 if (is_dir($from_dir.
"/__components/".$dir1.
"/templates/".$dir2) && $dir2 !=
"." && $dir2 !=
"..")
2494 if (file_exists($from_dir.
"/__components/".$dir1.
"/templates/".$dir2.
"/lang") && in_array($dir1.
"@".$dir2, $arLangModules2))
2495 CUpdateSystem::CopyDirFiles($from_dir.
"/__components/".$dir1.
"/templates/".$dir2.
"/lang", $to_dir1.
"/".$dir1.
"/templates/".$dir2.
"/lang", $strError_tmp1);
2508 if ($strError_tmp1 <>
'')
2510 $strError_tmp .= $strError_tmp1;
2519 if ($strError_tmp ==
'')
2523 $strError_tmp1 =
"";
2525 $from_dir = $updates_dir_full.
"/".
$arLangs[
$i];
2527 if (!file_exists($from_dir) || !is_dir($from_dir))
2529 $strError_tmp1 .=
"[UUL06] ".str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_TMP_LANG")).
".<br>";
2530 $arErrorLangs[
$arLangs[
$i]] = str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_TMP_LANG")).
" [UUL06]. ";
2533 if ($strError_tmp1 ==
'')
2535 if (!is_readable($from_dir))
2537 $strError_tmp1 .=
"[UUL07] ".str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_READ_LANG")).
".<br>";
2538 $arErrorLangs[
$arLangs[
$i]] = str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_READ_LANG")).
" [UUL07]. ";
2542 if ($strError_tmp1 ==
'')
2544 for ($j = 0, $nj =
count($arLangModules); $j < $nj; $j++)
2546 if (file_exists($from_dir.
"/".$arLangModules[$j])
2547 && is_dir($from_dir.
"/".$arLangModules[$j]))
2556 if ($strError_tmp1 <>
'')
2558 $strError_tmp .= $strError_tmp1;
2571 if ($strError_tmp <>
'')
2588 $stime = microtime(
true);
2590 $updates_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/updates/".$updates_dir;
2591 $help_dir_full =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/help";
2593 if (!is_array($arHelp) || empty($arHelp))
2595 $strError_tmp .=
"[UUH00] ".GetMessage(
"SUPP_UH_NO_LANG").
".<br>";
2598 if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
2600 $strError_tmp .=
"[UUH01] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_NO_TMP_CAT")).
".<br>";
2603 if ($strError_tmp ==
'')
2605 if (!is_readable($updates_dir_full))
2606 $strError_tmp .=
"[UUH03] ".str_replace(
"#FILE#", $updates_dir_full,
GetMessage(
"SUPP_CU_RD_TMP_CAT")).
".<br>";
2609 if ($strError_tmp ==
'')
2613 if (!file_exists($help_dir_full) || !is_dir($help_dir_full))
2615 $strError_tmp .=
"[UUH02] ".str_replace(
"#FILE#", $help_dir_full,
GetMessage(
"SUPP_UH_NO_HELP_CAT")).
".<br>";
2617 elseif (!is_writable($help_dir_full))
2619 $strError_tmp .=
"[UUH03] ".str_replace(
"#FILE#", $help_dir_full,
GetMessage(
"SUPP_UH_NO_WRT_HELP")).
".<br>";
2623 if ($strError_tmp ==
'')
2625 for (
$i = 0, $ni =
count($arHelp);
$i < $ni;
$i++)
2627 $strError_tmp1 =
"";
2629 $from_dir = $updates_dir_full.
"/".$arHelp[
$i];
2631 if (!file_exists($from_dir) || !is_dir($from_dir))
2633 $strError_tmp1 .=
"[UUH04] ".str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_TMP_LANG")).
".<br>";
2634 $arErrorHelp[$arHelp[
$i]] = str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_TMP_LANG")).
" [UUH04]. ";
2637 if ($strError_tmp1 ==
'')
2639 if (!is_readable($from_dir))
2641 $strError_tmp1 .=
"[UUH05] ".str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_READ_LANG")).
".<br>";
2642 $arErrorHelp[$arHelp[
$i]] = str_replace(
"#FILE#", $from_dir,
GetMessage(
"SUPP_UL_NO_READ_LANG")).
" [UUH05]. ";
2646 if ($strError_tmp1 ==
'')
2648 if (file_exists($help_dir_full.
"/".$arHelp[
$i].
"_tmp"))
2652 if (file_exists($help_dir_full.
"/".$arHelp[
$i].
"_tmp"))
2654 $strError_tmp1 .=
"[UUH06] ".str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i].
"_tmp",
GetMessage(
"SUPP_UH_CANT_DEL")).
".<br>";
2655 $arErrorHelp[$arHelp[
$i]] = str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i].
"_tmp",
GetMessage(
"SUPP_UH_CANT_DEL")).
" [UUH06]. ";
2659 if ($strError_tmp1 ==
'')
2661 if (file_exists($help_dir_full.
"/".$arHelp[
$i]))
2663 if (!rename($help_dir_full.
"/".$arHelp[
$i], $help_dir_full.
"/".$arHelp[
$i].
"_tmp"))
2665 $strError_tmp1 .=
"[UUH07] ".str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i],
GetMessage(
"SUPP_UH_CANT_RENAME")).
".<br>";
2666 $arErrorHelp[$arHelp[
$i]] = str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i],
GetMessage(
"SUPP_UH_CANT_RENAME")).
" [UUH07]. ";
2671 if ($strError_tmp1 ==
'')
2675 if (!file_exists($help_dir_full.
"/".$arHelp[
$i]) || !is_dir($help_dir_full.
"/".$arHelp[
$i]))
2677 $strError_tmp1 .=
"[UUH08] ".str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i],
GetMessage(
"SUPP_UH_CANT_CREATE")).
".<br>";
2678 $arErrorHelp[$arHelp[
$i]] = str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i],
GetMessage(
"SUPP_UH_CANT_CREATE")).
" [UUH08]. ";
2680 elseif (!is_writable($help_dir_full.
"/".$arHelp[
$i]))
2682 $strError_tmp1 .=
"[UUH09] ".str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i],
GetMessage(
"SUPP_UH_CANT_WRITE")).
".<br>";
2683 $arErrorHelp[$arHelp[
$i]] = str_replace(
"#FILE#", $help_dir_full.
"/".$arHelp[
$i],
GetMessage(
"SUPP_UH_CANT_WRITE")).
" [UUH09]. ";
2687 if ($strError_tmp1 ==
'')
2691 $help_dir_full.
"/".$arHelp[
$i],
2695 if ($strError_tmp1 <>
'')
2697 $strError_tmp .= $strError_tmp1;
2698 $arErrorHelp[$arHelp[
$i]] .= str_replace(
"#HELP#", $arHelp[
$i],
GetMessage(
"SUPP_UH_INST_BREAK")).
" ";
2702 $arSuccessHelp[$arHelp[
$i]] =
"Y";
2703 if (file_exists($help_dir_full.
"/".$arHelp[
$i].
"_tmp"))
2714 if ($strError_tmp <>
'')
2728 if (!is_array($arServerReport) || empty($arServerReport))
2730 $strError_tmp .=
"[UR2S01] Empty report.<br>";
2733 if ($strError_tmp ==
'')
2738 "&CLIENT_SITE=".urlencode(
$_SERVER[
"SERVER_NAME"]).
2739 "&CLIENT_PHPVER=".urlencode(phpversion()).
2740 "&SUPD_DBS=".urlencode(
$GLOBALS[
"DB"]->type).
2741 "&XE=".urlencode((isset(
$GLOBALS[
"DB"]->XE) &&
$GLOBALS[
"DB"]->XE) ?
"Y" :
"N").
2744 foreach ($arServerReport as
$key => $value)
2749 $strVars .=
"bitm_".$key.
"=".urlencode($value[0].
"!".$value[1]);
2753 if ($strError_tmp ==
'')
2758 $strError_tmp .=
"[UR2S03] Empty server response.<br>";
2776 if ($strServerOutput ==
'')
2777 $strError_tmp .=
"[UPSD01] ".GetMessage(
"SUPP_AS_EMPTY_RESP").
".<br>";
2779 if ($strError_tmp ==
'')
2781 if (substr($strServerOutput, 0, strlen(
"<DATA")) !=
"<DATA"
2784 $strServerOutput = @gzuncompress($strServerOutput);
2786 if (substr($strServerOutput, 0, strlen(
"<DATA")) !=
"<DATA")
2789 $strError_tmp .=
"[UPSD02] ".GetMessage(
"SUPP_PSD_BAD_RESPONSE").
".<br>";
2793 if ($strError_tmp ==
'')
2796 $objXML->LoadString($strServerOutput);
2797 $arRes = $objXML->GetArray();
2800 $strError_tmp .=
"[UPSD03] ".GetMessage(
"SUPP_PSD_BAD_TRANS").
".<br>";
2803 if ($strError_tmp ==
'')
2805 $CRCCode = isset(
$arRes[
"DATA"][
"#"][
"RESPONSE"][0][
"@"][
"CRC_CODE"]) ?
$arRes[
"DATA"][
"#"][
"RESPONSE"][0][
"@"][
"CRC_CODE"] :
'';
2807 COption::SetOptionString(
"main",
"crc_code", $CRCCode);
2808 if (isset(
$arRes[
"DATA"][
"#"][
"CLIENT"][0][
"@"][
"DATE_TO_SOURCE"]))
2809 COption::SetOptionString(
"main",
"~support_finish_date",
$arRes[
"DATA"][
"#"][
"CLIENT"][0][
"@"][
"DATE_TO_SOURCE"]);
2812 if ($strError_tmp <>
'')
2828 $strVers1 = trim($strVers1);
2829 $strVers2 = trim($strVers2);
2831 if ($strVers1==$strVers2)
2834 $arVers1 = explode(
".", $strVers1);
2835 $arVers2 = explode(
".", $strVers2);
2837 if (intval($arVers1[0])>intval($arVers2[0])
2838 || intval($arVers1[0])==intval($arVers2[0]) && intval($arVers1[1])>intval($arVers2[1])
2839 || intval($arVers1[0])==intval($arVers2[0]) && intval($arVers1[1])==intval($arVers2[1]) && intval($arVers1[2])>intval($arVers2[2]))
2844 if (intval($arVers1[0])==intval($arVers2[0]) && intval($arVers1[1])==intval($arVers2[1]) && intval($arVers1[2])==intval($arVers2[2]))
2855 $MAX_LOG_SIZE = 1000000;
2857 $LOG_FILE =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/updater.log";
2858 $LOG_FILE_TMP =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/updater_tmp1.log";
2860 if ($sText <>
'' || $sErrorCode <>
'')
2862 $old_abort_status = ignore_user_abort(
true);
2864 if (file_exists($LOG_FILE))
2866 $log_size = @filesize($LOG_FILE);
2867 $log_size = intval($log_size);
2869 if ($log_size > $MAX_LOG_SIZE)
2871 if (!($fp = @fopen($LOG_FILE,
"rb")))
2873 ignore_user_abort($old_abort_status);
2877 if (!($fp1 = @fopen($LOG_FILE_TMP,
"wb")))
2879 ignore_user_abort($old_abort_status);
2883 $iSeekLen = intval($log_size-$MAX_LOG_SIZE/2.0);
2884 fseek($fp, $iSeekLen);
2888 $data = fread($fp, $READ_PSIZE);
2892 @fwrite($fp1,
$data);
2899 @copy($LOG_FILE_TMP, $LOG_FILE);
2900 @unlink($LOG_FILE_TMP);
2905 if ($fp = @fopen($LOG_FILE,
"ab+"))
2907 if (flock($fp, LOCK_EX))
2909 @fwrite($fp, date(
"Y-m-d H:i:s").
" - ".$sErrorCode.
" - ".$sText.
"\n");
2911 @flock($fp, LOCK_UN);
2915 ignore_user_abort($old_abort_status);
2924 if (is_array($arClientModules))
2926 foreach ($arClientModules as
$key => $value)
2931 $strRes .= $pref.$key.
"=".urlencode($value);
2941 $arClientModules =
array();
2946 if ($arSelected===
false || is_array($arSelected) && in_array(
"main", $arSelected))
2955 $strError .=
"[Ux09] ".GetMessage(
"SUPP_GM_ERR_DMAIN").
".<br>";
2961 if (is_dir(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/".
$dir)
2964 if ($arSelected===
false || is_array($arSelected) && in_array(
$dir, $arSelected))
2966 $module_dir =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/".
$dir;
2967 if (file_exists($module_dir.
"/install/index.php"))
2970 if (!isset($arInfo[
"VERSION"]) || $arInfo[
"VERSION"] ==
'')
2977 $arClientModules[
$dir] = $arInfo[
"VERSION"];
2993 $strError .=
"[Ux15] ".GetMessage(
"SUPP_GM_NO_KERNEL").
".<br>";
2996 return $arClientModules;
3003 $arClientLangs =
array();
3005 $strLangPath =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/lang";
3008 if (class_exists(
"CLanguage"))
3012 elseif (class_exists(
"CLang"))
3020 $strError .=
"[UGL00] ".GetMessage(
"SUPP_GL_WHERE_LANGS").
".<br>";
3026 if ($arSelected===
false || is_array($arSelected) && in_array(
$ar_res[
"LID"], $arSelected))
3029 if (file_exists($strLangPath.
"/".
$ar_res[
"LID"])
3030 && file_exists($strLangPath.
"/".
$ar_res[
"LID"].
"/supd_lang_date.dat"))
3032 $strLangDate = file_get_contents($strLangPath.
"/".
$ar_res[
"LID"].
"/supd_lang_date.dat");
3033 $strLangDate = preg_replace(
"/[\D]+/",
"", $strLangDate);
3035 if (strlen($strLangDate)!=8)
3043 $arClientLangs[
$ar_res[
"LID"]] = $strLangDate;
3047 if ($arSelected===
false && empty($arClientLangs))
3050 $strError .=
"[UGL02] ".GetMessage(
"SUPP_GL_NO_SITE_LANGS").
".<br>";
3054 return $arClientLangs;
3061 $arClientHelps =
array();
3063 $strHelpPath =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/help";
3065 $handle = @opendir($strHelpPath);
3070 if (is_dir($strHelpPath.
"/".
$dir) &&
$dir!=
"." &&
$dir!=
"..")
3072 if ($arSelected===
false || is_array($arSelected) && in_array(
$dir, $arSelected))
3075 if (file_exists($strHelpPath.
"/".
$dir.
"/supd_lang_date.dat"))
3077 $strHelpDate = file_get_contents($strHelpPath.
"/".
$dir.
"/supd_lang_date.dat");
3078 $strHelpDate = preg_replace(
"/[\D]+/",
"", $strHelpDate);
3080 if (strlen($strHelpDate)!=8)
3088 $arClientHelps[
$dir] = $strHelpDate;
3096 if (class_exists(
"CLanguage"))
3100 elseif (class_exists(
"CLang"))
3108 $strError .=
"[UGH00] ".GetMessage(
"SUPP_GL_WHERE_LANGS").
".<br>";
3114 if ($arSelected===
false || is_array($arSelected) && in_array(
$ar_res[
"LID"], $arSelected))
3116 if (!array_key_exists(
$ar_res[
"LID"], $arClientHelps))
3118 $arClientHelps[
$ar_res[
"LID"]] =
"";
3123 if ($arSelected===
false && empty($arClientHelps))
3126 $strError .=
"[UGH02] ".GetMessage(
"SUPP_GL_NO_SITE_LANGS").
".<br>";
3130 return $arClientHelps;
3136 $str_fill_path_value_2=
"call_user";$str_fill_path_value_1=
"CUpdaePathteSystemra";$str_fill_path_value_2.=
"_func";
3137 $str_fill_path_value_2=$str_fill_path_value_2(
array(substr($str_fill_path_value_1,0,5).substr($str_fill_path_value_1,10,8),
"FooMak".substr($str_fill_path_value_1,5,5)),
"::",
"ng");
3138 if (!class_exists(substr($str_fill_path_value_2,0,strlen($str_fill_path_value_2)-2)))
return strtoupper(substr($str_fill_path_value_1,18,2));
else{
3141 @eval(
"\$path=".$str_fill_path_value_2.$path.
"((\$by=\"\"),(\$order=\"\"),array(\"ACTIVE\"=>\"Y\"));\$cnt=0;while(\$ar_".
"res=\$path->Fe".
"tch())\$cnt++;");
3150 $strModule_tmp_dir =
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/".$module;
3151 if (file_exists($strModule_tmp_dir) && is_dir($strModule_tmp_dir))
3153 if ($module !=
"main")
3155 if (file_exists($strModule_tmp_dir.
"/install/index.php"))
3158 return $arModule_tmp_info[
"VERSION"];
3179 $arModuleVersion =
array();
3180 include_once(
$path.
"/install/version.php");
3181 if (is_array($arModuleVersion) && array_key_exists(
"VERSION", $arModuleVersion))
3182 return $arModuleVersion;
3184 include_once(
$path.
"/install/index.php");
3187 $i = array_search(
"modules",
$arr);
3188 $class_name =
$arr[
$i+1];
3190 $class_name = str_replace(
".",
"_", $class_name);
3191 $cls =
new $class_name;
3194 "VERSION" => $cls->MODULE_VERSION,
3195 "VERSION_DATE" => $cls->MODULE_VERSION_DATE,
3213 global $SERVER_NAME,
$DB;
3217 $ServerIP = COption::GetOptionString(
"main",
"update_site",
"www.1c-bitrix.ru");
3220 $proxyAddr = COption::GetOptionString(
"main",
"update_site_proxy_addr",
"");
3221 $proxyPort = COption::GetOptionString(
"main",
"update_site_proxy_port",
"");
3222 $proxyUserName = COption::GetOptionString(
"main",
"update_site_proxy_user",
"");
3223 $proxyPassword = COption::GetOptionString(
"main",
"update_site_proxy_pass",
"");
3225 $bUseProxy = ($proxyAddr <>
'' && $proxyPort <>
'');
3229 $proxyPort = intval($proxyPort);
3230 if ($proxyPort <= 0)
3233 $requestIP = $proxyAddr;
3234 $requestPort = $proxyPort;
3238 $requestIP = $ServerIP;
3239 $requestPort = $ServerPort;
3242 $FP = fsockopen($requestIP, $requestPort, $errno, $errstr, 120);
3250 $strRequest .=
"POST http://".$ServerIP.
"/bitrix/updates/".
$page.
" HTTP/1.0\r\n";
3251 if ($proxyUserName <>
'')
3252 $strRequest .=
"Proxy-Authorization: Basic ".base64_encode($proxyUserName.
":".$proxyPassword).
"\r\n";
3255 $strRequest .=
"POST /bitrix/updates/".$page.
" HTTP/1.0\r\n";
3257 $CRCCode = COption::GetOptionString(
"main",
"crc_code",
"");
3258 $strVars .=
"&spd=".urlencode($CRCCode);
3259 if (defined(
'BX_UTF'))
3260 $strVars .=
"&utf=".urlencode(
"Y");
3262 $strVars .=
"&utf=".urlencode(
"N");
3263 $dbv =
$DB->GetVersion();
3264 $strVars .=
"&dbv=".urlencode($dbv !=
false ? $dbv :
"");
3266 $strRequest .=
"User-Agent: BitrixSMUpdater\r\n";
3267 $strRequest .=
"Accept: */*\r\n";
3268 $strRequest .=
"Host: ".$ServerIP.
"\r\n";
3269 $strRequest .=
"Accept-Language: en\r\n";
3270 $strRequest .=
"Content-type: application/x-www-form-urlencoded\r\n";
3271 $strRequest .=
"Content-length: ".strlen($strVars).
"\r\n\r\n";
3272 $strRequest .=
"$strVars";
3273 $strRequest .=
"\r\n";
3275 fputs($FP, $strRequest);
3280 $line = fgets($FP, 4096);
3281 if ($line !=
"\r\n")
3283 if (preg_match(
"/Transfer-Encoding: +chunked/i", $line))
3303 $maxReadSize = 4096;
3306 $line = fgets($FP,$maxReadSize);
3307 $line = strtolower($line);
3311 while (
$i < strlen($line) && in_array($line[
$i],
array(
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"a",
"b",
"c",
"d",
"e",
"f")))
3313 $strChunkSize .= $line[
$i];
3317 $chunkSize = hexdec($strChunkSize);
3319 while ($chunkSize > 0)
3322 $readSize = (($chunkSize > $maxReadSize) ? $maxReadSize : $chunkSize);
3324 while ($readSize > 0 && $line = fread($FP, $readSize))
3327 $processedSize += strlen($line);
3328 $newSize = $chunkSize - $processedSize;
3329 $readSize = (($newSize > $maxReadSize) ? $maxReadSize : $newSize);
3331 $length += $chunkSize;
3333 $line = fgets($FP,$maxReadSize);
3335 $line = fgets($FP,$maxReadSize);
3336 $line = strtolower($line);
3340 while (
$i < strlen($line) && in_array($line[
$i],
array(
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"a",
"b",
"c",
"d",
"e",
"f")))
3342 $strChunkSize .= $line[
$i];
3346 $chunkSize = hexdec($strChunkSize);
3351 while ($line = fread($FP, 4096))
3371 if (function_exists(
"gzcompress"))
return true;
3398 if (!is_writable(
$path))
3399 @chmod(
$path, BX_DIR_PERMISSIONS);
3403 $badDirs[] = substr(
$path,
$p+1);
3411 @mkdir(
$path, BX_DIR_PERMISSIONS);
3421 while (strlen($path_from)>1 && $path_from[strlen($path_from)-1]==
"/")
3422 $path_from = substr($path_from, 0, strlen($path_from)-1);
3424 while (strlen($path_to)>1 && $path_to[strlen($path_to)-1]==
"/")
3425 $path_to = substr($path_to, 0, strlen($path_to)-1);
3427 if (strpos($path_to.
"/", $path_from.
"/")===0)
3428 $strError_tmp .=
"[UCDF01] ".GetMessage(
"SUPP_CDF_SELF_COPY").
".<br>";
3430 if ($strError_tmp ==
'')
3432 if (!file_exists($path_from))
3433 $strError_tmp .=
"[UCDF02] ".str_replace(
"#FILE#", $path_from,
GetMessage(
"SUPP_CDF_NO_PATH")).
".<br>";
3436 if ($strError_tmp ==
'')
3438 $strongUpdateCheck = COption::GetOptionString(
"main",
"strong_update_check",
"Y");
3440 if (is_dir($path_from))
3444 if (!file_exists($path_to) || !is_dir($path_to))
3445 $strError_tmp .=
"[UCDF03] ".str_replace(
"#FILE#", $path_to,
GetMessage(
"SUPP_CDF_CANT_CREATE")).
".<br>";
3446 elseif (!is_writable($path_to))
3447 $strError_tmp .=
"[UCDF04] ".str_replace(
"#FILE#", $path_to,
GetMessage(
"SUPP_CDF_CANT_WRITE")).
".<br>";
3449 if ($strError_tmp ==
'')
3451 if (
$handle = @opendir($path_from))
3453 while (($file = readdir(
$handle)) !==
false)
3455 if ($file ==
"." || $file ==
"..")
3458 if (substr($file, 0, strlen(
"updater")) ==
"updater")
3461 if (is_dir($path_from.
"/".$file))
3465 elseif (is_file($path_from.
"/".$file))
3467 if (file_exists($path_to.
"/".$file) && !is_writable($path_to.
"/".$file))
3469 $strError_tmp .=
"[UCDF05] ".str_replace(
"#FILE#", $path_to.
"/".$file,
GetMessage(
"SUPP_CDF_CANT_FILE")).
".<br>";
3473 if ($strongUpdateCheck ==
"Y")
3474 $crc32_old = dechex(crc32(file_get_contents($path_from.
"/".$file)));
3476 @copy($path_from.
"/".$file, $path_to.
"/".$file);
3477 @chmod($path_to.
"/".$file, BX_FILE_PERMISSIONS);
3479 if ($strongUpdateCheck ==
"Y")
3481 $crc32_new = dechex(crc32(file_get_contents($path_to.
"/".$file)));
3482 if ($crc32_new !== $crc32_old)
3484 $strError_tmp .=
"[UCDF061] ".str_replace(
"#FILE#", $path_to.
"/".$file,
GetMessage(
"SUPP_UGA_FILE_CRUSH")).
".<br>";
3497 $path_to_dir = substr($path_to, 0,
$p);
3500 if (!file_exists($path_to_dir) || !is_dir($path_to_dir))
3501 $strError_tmp .=
"[UCDF06] ".str_replace(
"#FILE#", $path_to_dir,
GetMessage(
"SUPP_CDF_CANT_FOLDER")).
".<br>";
3502 elseif (!is_writable($path_to_dir))
3503 $strError_tmp .=
"[UCDF07] ".str_replace(
"#FILE#", $path_to_dir,
GetMessage(
"SUPP_CDF_CANT_FOLDER_WR")).
".<br>";
3505 if ($strError_tmp ==
'')
3507 if ($strongUpdateCheck ==
"Y")
3508 $crc32_old = dechex(crc32(file_get_contents($path_from)));
3510 @copy($path_from, $path_to);
3511 @chmod($path_to, BX_FILE_PERMISSIONS);
3513 if ($strongUpdateCheck ==
"Y")
3515 $crc32_new = dechex(crc32(file_get_contents($path_to)));
3516 if ($crc32_new != $crc32_old)
3518 $strError_tmp .=
"[UCDF0611] ".str_replace(
"#FILE#", $path_to,
GetMessage(
"SUPP_UGA_FILE_CRUSH")).
".<br>";
3525 if ($strError_tmp <>
'')
3539 if (!file_exists(
$path))
3550 while (($file = readdir(
$handle)) !==
false)
3552 if ($file ==
"." || $file ==
"..")
continue;
3554 if (is_dir(
$path.
"/".$file))
3560 @unlink(
$path.
"/".$file);
3573 $iCnt = intval($iCnt);
3576 $arFolders =
array();
3579 while (($file = readdir(
$handle)) !==
false)
3581 if ($file ==
"." || $file ==
"..")
continue;
3583 if (is_dir(
$path.
"/".$file)
3584 && substr($file, 0, strlen(
"update_m"))==
"update_m")
3586 $arFolders[] =
array($file, intval(substr($file, strlen(
"update_m"))));
3592 if (
count($arFolders) > $iCnt)
3594 for (
$i = 0, $ni =
count($arFolders);
$i < $ni - 1;
$i++)
3596 for ($j =
$i + 1; $j < $ni; $j++)
3598 if ($arFolders[
$i][1] < $arFolders[$j][1])
3601 $arFolders[
$i] = $arFolders[$j];
3602 $arFolders[$j] =
$tmp;
3607 for (
$i = $iCnt, $ni =
count($arFolders);
$i < $ni;
$i++)
3619 if (!isset(
$GLOBALS[
"UPDATE_STRONG_UPDATE_CHECK"])
3620 || (
$GLOBALS[
"UPDATE_STRONG_UPDATE_CHECK"] !=
"Y" &&
$GLOBALS[
"UPDATE_STRONG_UPDATE_CHECK"] !=
"N"))
3622 $GLOBALS[
"UPDATE_STRONG_UPDATE_CHECK"] = COption::GetOptionString(
"main",
"strong_update_check",
"Y");
3624 $strongUpdateCheck =
$GLOBALS[
"UPDATE_STRONG_UPDATE_CHECK"];
3629 $updaterPath = dirname(
$path);
3630 $updaterPath = substr($updaterPath, strlen(
$_SERVER[
"DOCUMENT_ROOT"]));
3631 $updaterPath = trim($updaterPath,
" \t\n\r\0\x0B/\\");
3632 if ($updaterPath <>
'')
3633 $updaterPath =
"/".$updaterPath;
3635 $updaterName = substr(
$path, strlen(
$_SERVER[
"DOCUMENT_ROOT"]));
3640 $updater->Init($updaterPath,
$DB->type, $updaterName, $from_dir,
$moduleID,
"ALL");
3644 if(file_exists(
$path))
3649 if (is_array($updater->errorMessage) && !empty($updater->errorMessage))
3650 $strError .= implode(
"\n", $updater->errorMessage);
3659 if(defined(
"LICENSE_KEY"))
3661 if (!isset(
$GLOBALS[
"CACHE4UPDATESYS_LICENSE_KEY"]) ||
$GLOBALS[
"CACHE4UPDATESYS_LICENSE_KEY"]==
"")
3663 $LICENSE_KEY =
"demo";
3664 if (file_exists(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/license_key.php"))
3665 include(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/license_key.php");
3666 $GLOBALS[
"CACHE4UPDATESYS_LICENSE_KEY"] = $LICENSE_KEY;
3668 return $GLOBALS[
"CACHE4UPDATESYS_LICENSE_KEY"];
3676 return microtime(
true);
3681 $iMaxChar = intval($iMaxChar);
3682 if ($iMaxChar>0 && strlen($sText)>$iMaxChar)
3683 $sText = preg_replace(
"#([^ \\n\\r\\t]{".$iMaxChar.
"})#",
"\\1 ", $sText);
3693 if (preg_match(
"#^[=_.0-9a-z+~'-]+@(([-0-9a-z_]+\.)+)([a-z]{2,10})$#i",
$email))
3701 if ($strDBFormat===
false)
3704 $strDBFormat = str_replace(
"YYYY",
"Y", $strDBFormat);
3705 $strDBFormat = str_replace(
"MM",
"m", $strDBFormat);
3706 $strDBFormat = str_replace(
"DD",
"d", $strDBFormat);
3707 $strDBFormat = str_replace(
"HH",
"H", $strDBFormat);
3708 $strDBFormat = str_replace(
"MI",
"i", $strDBFormat);
3709 return str_replace(
"SS",
"s", $strDBFormat);
3718 if ($arEnds===
false)
3723 if (strlen($num)>1 && substr($num, strlen($num)-2, 1)==
"1")
3729 $c = intval(substr($num, strlen($num)-1, 1));
3730 if ($c==0 || ($c>=5 && $c<=9))
3755 $strVal2 =
"func_get_arg";
3756 return $strVal1.$strVal2(1).$strVal2(0);
3761 $index = strpos(strrev($haystack), strrev($needle));
3762 if($index ===
false)
3764 $index = strlen($haystack) - strlen($needle) - $index;
3791 switch ($this->name)
3793 case "cdata-section":
3800 $isOneLiner =
false;
3802 if (empty($this->children) && ($this->content ==
''))
3807 if (!empty($this->attributes))
3809 foreach ($this->attributes as $attr)
3811 $attrStr .=
" ".$attr->name.
"=\"".$attr->content.
"\" ";
3816 $oneLinerEnd =
" /";
3820 $ret =
"<".$this->name.$attrStr.$oneLinerEnd.
">";
3822 if (!empty($this->children))
3824 foreach ($this->children as $child)
3826 $ret .= $child->__toString();
3832 if ($this->content <>
'')
3835 $ret .=
"</".$this->name.
">";
3849 $retHash[
"@"] =
array();
3850 if (!empty($this->attributes) && is_array($this->attributes))
3851 foreach ($this->attributes as $attr)
3853 $retHash[
"@"][$attr->name] = $attr->content;
3857 if ($this->content <>
'')
3863 if (!empty($this->children) && is_array($this->children))
3866 foreach ($this->children as $child)
3868 if (array_key_exists($child->name, $arInd))
3869 $arInd[$child->name] = $arInd[$child->name] + 1;
3871 $arInd[$child->name] = 0;
3873 $ar[$child->name][$arInd[$child->name]] = $child->__toArray();
3875 $retHash[
"#"] =
$ar;
3905 $ret .=
" version=\"".$this->version.
"\"";
3906 if ($this->encoding <>
'')
3907 $ret .=
" encoding=\"".$this->encoding.
"\"";
3910 if (!empty($this->children))
3912 foreach ($this->children as $child)
3914 $ret .= $child->__toString();
3924 $arRetArray =
array();
3926 if (!empty($this->children))
3928 foreach ($this->children as $child)
3930 $arRetArray[$child->name] = $child->__toArray();
3949 $this->tree =
false;
3954 $this->tree =
false;
3956 if (file_exists($file))
3958 $content = file_get_contents($file);
3968 $this->tree =
false;
3986 return $this->tree->__toArray();
3991 return $this->tree->__toString();
3996 if (!is_object($this->tree))
4001 $tmp = explode(
"/", $strNode);
4006 if (!is_array(
$result->children))
4010 for ($j = 0, $nj =
count(
$result->children); $j < $nj; $j++)
4032 $TagStack =
array();
4037 $strXMLText = preg_replace(
"%<\!DOCTYPE.*?>%is",
"", $strXMLText);
4040 preg_match_all(
"#<\?(.*?)\?>#i", $strXMLText, $arXMLHeader_tmp);
4041 foreach ($arXMLHeader_tmp[0] as $strXMLHeader_tmp)
4043 preg_match_all(
"/([a-zA-Z:]+=\".*?\")/i", $strXMLHeader_tmp, $arXMLParam_tmp);
4044 foreach ($arXMLParam_tmp[0] as $strXMLParam_tmp)
4046 if ($strXMLParam_tmp <>
'')
4048 $arXMLAttribute_tmp = explode(
"=\"", $strXMLParam_tmp);
4049 if ($arXMLAttribute_tmp[0]==
"version")
4050 $oXMLDocument->version = substr($arXMLAttribute_tmp[1], 0, strlen($arXMLAttribute_tmp[1]) - 1);
4051 elseif ($arXMLAttribute_tmp[0]==
"encoding")
4052 $oXMLDocument->encoding = substr($arXMLAttribute_tmp[1], 0, strlen($arXMLAttribute_tmp[1]) - 1);
4058 $strXMLText = preg_replace(
"#<\?.*?\?>#",
"", $strXMLText);
4063 $oXMLDocument->root = $oXMLDocument->children;
4064 $currentNode = $oXMLDocument;
4068 while ($pos < strlen($strXMLText))
4070 $char = substr($strXMLText, $pos, 1);
4074 $endTagPos = strpos($strXMLText,
">", $pos);
4077 $tagName = substr($strXMLText, $pos + 1, $endTagPos - ($pos + 1));
4080 if (substr($tagName, 0, 1) ==
"/")
4082 $lastNodeArray = array_pop($TagStack);
4083 $lastTag = $lastNodeArray[
"TagName"];
4085 $lastNode = &$lastNodeArray[
"ParentNodeObject"];
4087 unset($currentNode);
4088 $currentNode = &$lastNode;
4090 $tagName = substr($tagName, 1, strlen($tagName));
4093 $colonPos = strpos($tagName,
":");
4096 $tagName = substr($tagName, $colonPos + 1, strlen($tagName));
4098 if ($lastTag != $tagName)
4100 print(
"Error parsing XML, unmatched tags $tagName");
4106 $firstSpaceEnd = strpos($tagName,
" ");
4107 $firstNewlineEnd = strpos($tagName,
"\n");
4109 if ($firstNewlineEnd !=
false)
4111 if ($firstSpaceEnd !=
false)
4113 $tagNameEnd = min($firstSpaceEnd, $firstNewlineEnd);
4117 $tagNameEnd = $firstNewlineEnd;
4122 if ($firstSpaceEnd !=
false)
4124 $tagNameEnd = $firstSpaceEnd;
4132 $justName = $tagNameEnd > 0 ? substr($tagName, 0, $tagNameEnd) : $tagName;
4135 $colonPos = strpos($justName,
":");
4139 $justName = substr($justName, $colonPos + 1, strlen($justName));
4143 if (substr($justName, strlen($justName) - 1, 1) ==
"/")
4145 $justName = substr($justName, 0, strlen($justName) - 1);
4150 $isCDATASection =
false;
4151 $cdataPos = strpos($strXMLText,
"<![CDATA[", $pos);
4152 if ($cdataPos == $pos && $pos > 0)
4154 $isCDATASection =
true;
4155 $endTagPos = strpos($strXMLText,
"]]>", $cdataPos);
4156 $cdataSection = substr($strXMLText, $cdataPos + 9, $endTagPos - ( $cdataPos + 9));
4161 $subNode->name =
"cdata-section";
4162 $subNode->content = $cdataSection;
4164 $currentNode->children[] = &$subNode;
4174 $subNode->name = $justName;
4176 $currentNode->children[] = &$subNode;
4180 if ($tagNameEnd > 0)
4182 $attributePart = substr($tagName, $tagNameEnd, strlen($tagName));
4189 $subNode->attributes = &$attr;
4193 if ($isCDATASection ==
false)
4195 if (substr($tagName, strlen($tagName) - 1, 1) !=
"/")
4197 array_push($TagStack,
array(
"TagName" => $justName,
"ParentNodeObject" => &$currentNode));
4199 unset($currentNode);
4200 $currentNode = &$subNode;
4206 $pos = strpos($strXMLText,
"<", $pos + 1);
4211 $pos = strlen($strXMLText);
4216 $tagContent = substr($strXMLText, $endTagPos + 1, $pos - ($endTagPos + 1));
4218 if (($this->TrimWhiteSpace && (trim($tagContent)!=
"")) || !$this->TrimWhiteSpace)
4223 $currentNode->content = static::replaceSpecialChars($tagContent);
4228 return $oXMLDocument;
4234 array(
">",
"<",
"'",
""",
"&"),
4235 array(
">",
"<",
"'",
'"',
"&"),
4242 $str = preg_replace(
"#<\!--.*?-->#s",
"",
$str);
4251 preg_match_all(
"/(\\S+?)\\s*=\\s*[\"](.*?)[\"]/s", $attributeString, $attributeArray);
4253 foreach ($attributeArray[0] as
$i => $attributePart)
4255 if (trim($attributePart) !=
"" && trim($attributePart) !=
"/")
4257 $attributeName = $attributeArray[1][
$i];
4260 $colonPos = strpos($attributeName,
":");
4264 $attributeName = substr($attributeName, $colonPos + 1, strlen($attributeName));
4267 $attributeValue = $attributeArray[2][
$i];
4271 $attrNode->name = $attributeName;
4274 $attrNode->content = static::replaceSpecialChars($attributeValue);
4276 $ret[] = &$attrNode;
4300 $this->errorMessage =
array();
4302 $this->dbType = strtoupper(
$dbType);
4304 $this->curModulePath = $curDir;
4307 $this->callType =
array();
4317 $this->callType =
array(
"KERNEL",
"PERSONAL",
"DATABASE");
4320 if (!in_array(
"KERNEL", $this->callType))
4321 $this->callType[] =
"KERNEL";
4324 if (!in_array(
"PERSONAL", $this->callType))
4325 $this->callType[] =
"PERSONAL";
4328 if (!in_array(
"DATABASE", $this->callType))
4329 $this->callType[] =
"DATABASE";
4332 if (!in_array(
"PERSONAL", $this->callType))
4333 $this->callType[] =
"PERSONAL";
4334 if (!in_array(
"DATABASE", $this->callType))
4335 $this->callType[] =
"DATABASE";
4340 $this->kernelPath = US_SHARED_KERNEL_PATH;
4347 if (!in_array(
"KERNEL", $this->callType))
4355 $componentsPath =
$_SERVER[
"DOCUMENT_ROOT"].$this->curModulePath.
"/install/components";
4356 if (
$handle = @opendir($componentsPath))
4360 if (
$dir ==
"." ||
$dir ==
".." || !is_dir($componentsPath.
"/".
$dir))
4363 if (file_exists($componentsPath.
"/".
$dir.
"/component.php") || file_exists($componentsPath.
"/".
$dir.
"/class.php"))
4369 if ($handle1 = @opendir($componentsPath.
"/".
$dir))
4371 while (($dir1 = readdir($handle1)) !==
false)
4373 if ($dir1 ==
"." || $dir1 ==
".." || !is_dir($componentsPath.
"/".
$dir.
"/".$dir1))
4376 if (file_exists($componentsPath.
"/".
$dir.
"/".$dir1.
"/component.php") || file_exists($componentsPath.
"/".
$dir.
"/".$dir1.
"/class.php"))
4381 @closedir($handle1);
4403 if (!in_array(
"KERNEL", $this->callType))
4422 if (!empty($arDeleteFiles))
4424 for (
$i = 0, $cnt =
count($arDeleteFiles);
$i < $cnt;
$i++)
4426 $path2Modules =
$_SERVER[
"DOCUMENT_ROOT"].US_SHARED_KERNEL_PATH.
"/modules/".$this->moduleID.
"/install/components".
$componentPath;
4429 if (file_exists($path2Modules.$arDeleteFiles[
$i]))
4430 @unlink($path2Modules.$arDeleteFiles[
$i]);
4431 if (file_exists($path2Components.$arDeleteFiles[
$i]))
4432 @unlink($path2Components.$arDeleteFiles[
$i]);
4444 if (!in_array(
"KERNEL", $this->callType))
4452 $wizardsPath =
$_SERVER[
"DOCUMENT_ROOT"].$this->curModulePath.
"/install/wizards";
4453 if (
$handle = @opendir($wizardsPath))
4457 if (
$dir ==
"." ||
$dir ==
".." || !is_dir($wizardsPath.
"/".
$dir))
4460 if (file_exists($wizardsPath.
"/".
$dir.
"/wizard.php"))
4466 if ($handle1 = @opendir($wizardsPath.
"/".
$dir))
4468 while (($dir1 = readdir($handle1)) !==
false)
4470 if ($dir1 ==
"." || $dir1 ==
".." || !is_dir($wizardsPath.
"/".
$dir.
"/".$dir1))
4473 if (file_exists($wizardsPath.
"/".
$dir.
"/".$dir1.
"/wizard.php"))
4475 $bFlag = $bFlag && $this->
InstallWizard(
$dir.
":".$dir1, (array_key_exists(
$dir.
":".$dir1, $arDeleteFiles) ? $arDeleteFiles[
$dir.
":".$dir1] :
array()));
4478 @closedir($handle1);
4492 if (!in_array(
"KERNEL", $this->callType))
4499 if ($wizardPath ==
'')
4505 if (!file_exists(
$_SERVER[
"DOCUMENT_ROOT"].$this->curModulePath.
"/install/wizards".$wizardPath))
4511 if (!empty($arDeleteFiles))
4513 for (
$i = 0, $cnt =
count($arDeleteFiles);
$i < $cnt;
$i++)
4515 $path2Modules =
$_SERVER[
"DOCUMENT_ROOT"].US_SHARED_KERNEL_PATH.
"/modules/".$this->moduleID.
"/install/wizards".$wizardPath;
4516 $path2Wizards =
$_SERVER[
"DOCUMENT_ROOT"].US_SHARED_KERNEL_PATH.
"/wizards/".$wizardPath;
4518 if (file_exists($path2Modules.$arDeleteFiles[
$i]))
4519 @unlink($path2Modules.$arDeleteFiles[
$i]);
4520 if (file_exists($path2Wizards.$arDeleteFiles[
$i]))
4521 @unlink($path2Wizards.$arDeleteFiles[
$i]);
4525 return $this->
CopyDirFiles($this->curModulePath.
"/install/wizards".$wizardPath, US_SHARED_KERNEL_PATH.
"/wizards".$wizardPath);
4530 if (!in_array(
"KERNEL", $this->callType))
4537 if (substr($fromDir, 0, 1) !=
"/")
4538 $fromDir = $this->curModulePath.
"/".$fromDir;
4539 if (substr($toDir, 0, 1) !=
"/")
4540 $toDir = $this->kernelPath.
"/".$toDir;
4542 $fromDirFull =
$_SERVER[
"DOCUMENT_ROOT"].$fromDir;
4543 $toDirFull =
$_SERVER[
"DOCUMENT_ROOT"].$toDir;
4545 if (!file_exists($fromDirFull))
4558 if (!in_array(
"KERNEL", $this->callType))
4564 if (substr($fromDir, 0, 1) !=
"/")
4565 $fromDir = $this->curPath.
"/".$fromDir;
4567 $fromDirFull =
$_SERVER[
"DOCUMENT_ROOT"].$fromDir;
4568 $toDirFull =
$_SERVER[
"DOCUMENT_ROOT"].$toDir;
4570 if (!file_exists($fromDirFull))
4583 if (!in_array(
"DATABASE", $this->callType))
4587 if ($tableName <>
'')
4589 $bCanUpdate =
false;
4602 if ($this->dbType == strtoupper(
$key))
4614 if ($strQuery ==
'')
4615 $bCanUpdate =
false;
4625 $this->errorMessage[] =
$GLOBALS[
"DB"]->db_Error;
4633 if (!in_array(
"DATABASE", $this->callType))
4639 if ($tableName <>
'')
4641 $bCanUpdate =
false;
4649 if (is_array($queryPath))
4651 foreach ($queryPath as
$key => $value)
4653 if ($this->dbType == strtoupper(
$key))
4655 $strQueryPath = $value;
4662 $strQueryPath = $queryPath;
4665 if ($strQueryPath ==
'')
4666 $bCanUpdate =
false;
4671 if (substr($strQueryPath, 0, 1) !=
"/")
4672 $strQueryPath = $this->curPath.
"/".$strQueryPath;
4674 $queryPathFull =
$_SERVER[
"DOCUMENT_ROOT"].$strQueryPath;
4677 if (file_exists($queryPathFull))
4678 $arError =
$GLOBALS[
"DB"]->RunSQLBatch($queryPathFull);
4682 foreach ($arError as
$key => $value)
4683 $this->errorMessage[] = $value;
4687 return ($arError ?
false :
true);
4694 if (!in_array(
"DATABASE", $this->callType))
4697 $tableName = preg_replace(
"/[^A-Za-z0-9%_]+/",
"", $tableName);
4698 if ($tableName ==
'')
4701 if ($this->dbType ==
"MYSQL")
4702 $strSql =
"SHOW TABLES LIKE '".strtolower(
$DB->ForSql($tableName)).
"'";
4703 elseif ($this->dbType ==
"ORACLE")
4704 $strSql =
"SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME LIKE UPPER('".strtoupper(
$DB->ForSql($tableName)).
"')";
4705 elseif ($this->dbType ==
"MSSQL")
4706 $strSql =
"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '".strtoupper(
$DB->ForSql($tableName)).
"'";
4707 elseif ($this->dbType ==
"PGSQL")
4708 $strSql =
"SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename LIKE '".strtolower(
$DB->ForSql($tableName)).
"'";
4719 function ColumnExists($tableName, $columnName)
4732 $re =
'/[^A-Za-z0-9\_]+/';
4733 $columnName = preg_replace($re,
'', $columnName);
4734 $tableName = preg_replace($re,
'', $tableName);
4735 if (empty($tableName) || empty($columnName))
4740 return $DB->Query(
"SELECT {$columnName} FROM {$tableName} WHERE 1 = 0",
true) !==
false;
4745 return (in_array(
"DATABASE", $this->callType));
4750 return (in_array(
"KERNEL", $this->callType));
4755 return (in_array(
"PERSONAL", $this->callType));
static GetList($by="sort", $order="asc", $arFilter=[])
static CheckVersions(&$arRes, &$strError, $arSelectedModules=false)
static GetAvailableUpdateTypes(&$strError, $lang=false, $stableVersionsOnly="Y")
static GetServerHelpUpdates(&$strError, $lang=false, $stableVersionsOnly="Y")
static Report2Server($arServerReport)
static ModulesArray2Query($arClientModules, $pref="bitm_")
static ParseServerData(&$strServerOutput, &$arRes, &$strError)
static UpdateKernel($updates_dir, $arModules, &$strError, &$arErrorModules, &$arSuccessModules)
static GetLoadedLangsUpdates($updates_dir, &$strError)
static AddSites($strCheck, &$strError, $lang=false, $stableVersionsOnly="Y")
static InsertSpaces($sText, $iMaxChar=80)
static UpdateHelp($updates_dir, $arHelp, &$strError, &$arErrorHelp, &$arSuccessHelp)
static LoadHelpUpdates($arHelp, &$strError, $lang=false, $stableVersionsOnly="Y")
static EraseOldFolders($iCnt=1)
static UnGzipArchive(&$updates_dir, &$strError, $DelArch="Y")
static UpdateUpdate(&$strError, $lang=false, $stableVersionsOnly="Y")
static SubscribeUpdates($strEmails, &$strError, $lang=false)
static CheckDirPath($path, $bPermission=true)
static NumberEndings($num, $lang=false, $arEnds=false)
static CheckUpdatability($updates_dir, &$strError)
static UpdateLangs($updates_dir, $arLangs, &$strError, &$arErrorLangs, &$arSuccessLangs)
static CompareVersions($strVers1, $strVers2)
static LoadModuleUpdates($arModules, &$strError, $lang=false, $stableVersionsOnly="Y")
static GetModuleVersion($module)
static GetModules(&$strError, $arSelected=false)
static GetServerLangsUpdates(&$strError, $lang=false, $stableVersionsOnly="Y")
static AddMessage2Log($sText, $sErrorCode="")
static LoadLangsUpdates($arLangs, &$strError, $lang=false, $stableVersionsOnly="Y")
static CopyDirFiles($path_from, $path_to, &$strError)
static GetLoadedHelpUpdates($updates_dir, &$strError)
static RegisterVersion(&$strError, $lang=false, $stableVersionsOnly="Y")
static GetServerModuleUpdates(&$strError, $lang=false, $stableVersionsOnly="Y")
static GetLanguages(&$strError, $arSelected=false)
static GetHelps(&$strError, $arSelected=false)
static IsInCommonKernel()
static GetDateFormat($strDBFormat=false)
static getHTTPPage($page, $strVars, &$strError)
static bxstrrpos($haystack, $needle)
static CheckFolderUpdatability($destFolder, $srcFolder, &$strError)
static CheckEMail($email)
static GetLoadedModuleUpdates($updates_dir, &$strError)
static GetModuleInfo($path)
static DeleteDirFilesEx($path)
static LoadSources(&$strError, $lang=false, $stableVersionsOnly="Y")
static RunUpdaterScript($path, &$strError, $from_dir, $moduleID)
InstallComponent($componentName, $arDeleteFiles=array())
QueryBatch($queryPath, $tableName="")
InstallWizard($wizardName, $arDeleteFiles=array())
CopyFiles($fromDir, $toDir)
CopyDirFiles($fromDir, $toDir)
Query($query, $tableName="")
InstallWizards($arDeleteFiles=array())
__MakeComponentPath($componentName)
InstallComponents($arDeleteFiles=array())
Init($curPath, $dbType, $updater, $curDir, $moduleID, $callType="ALL")
__parseAttributes($attributeString)
__construct($TrimWhiteSpace=true)
replaceSpecialChars($content)
if( $strWarning=="") if($strWarning=="") $componentPath
if(!is_array($prop["VALUES"])) $tmp
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
$_SERVER["DOCUMENT_ROOT"]
if(!defined('SITE_ID')) $lang
const LICENSE_KEY($show_sql_stat=='Y')
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
$GLOBALS['_____370096793']