1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
updatetools.php
См. документацию.
1
<?php
2
3
use
Bitrix\Main
;
4
5
IncludeModuleLangFile
(__FILE__);
6
7
class
UpdateTools
8
{
9
public
static
function
CheckUpdates
()
10
{
11
global
$USER
;
12
13
if
(
Main
\
Application::getInstance
()->getLicense()->isDemoKey())
14
{
15
return
;
16
}
17
18
$days_check = intval(COption::GetOptionString(
'main'
,
'update_autocheck'
));
19
if
($days_check > 0)
20
{
21
CUtil::SetPopupOptions(
'update_tooltip'
,
array
(
'display'
=>
'on'
));
22
23
$update_res = unserialize(COption::GetOptionString(
'main'
,
'~update_autocheck_result'
), [
'allowed_classes'
=>
false
]);
24
if
(!is_array($update_res))
25
$update_res =
array
(
"check_date"
=>0,
"result"
=>
false
);
26
27
if
(time() > $update_res[
"check_date"
]+$days_check*86400)
28
{
29
if
(
$USER
->CanDoOperation(
'install_updates'
))
30
{
31
$result
= CUpdateClient::IsUpdateAvailable($arModules,
$strError
);
32
33
$modules
=
array
();
34
foreach
($arModules as $module)
35
$modules
[] = $module[
"@"
][
"ID"
];
36
37
if
(
$strError <>
''
&& COption::GetOptionString(
'main'
,
'update_stop_autocheck'
,
'N'
) ==
'Y'
)
38
COption::SetOptionString(
'main'
,
'update_autocheck'
,
''
);
39
40
COption::SetOptionString(
'main'
,
'~update_autocheck_result'
, serialize(
array
(
41
"check_date"
=>time(),
42
"result"
=>
$result
,
43
"error"
=>
$strError
,
44
"modules"
=>
$modules
,
45
)));
46
}
47
}
48
}
49
}
50
51
public
static
function
SetUpdateResult
()
52
{
53
COption::SetOptionString(
'main'
,
'~update_autocheck_result'
, serialize(
array
(
54
"check_date"
=>time(),
55
"result"
=>
false
,
56
"error"
=>
""
,
57
"modules"
=>
array
(),
58
)));
59
}
60
61
public
static
function
SetUpdateError
(
$strError
)
62
{
63
$update_res = unserialize(COption::GetOptionString(
'main'
,
'~update_autocheck_result'
), [
'allowed_classes'
=>
false
]);
64
if
(!is_array($update_res))
65
$update_res =
array
(
"check_date"
=>0,
"result"
=>
false
);
66
67
if
(
$strError <>
''
)
68
$update_res[
"result"
] =
false
;
69
$update_res[
"error"
] =
$strError
;
70
71
COption::SetOptionString(
'main'
,
'~update_autocheck_result'
, serialize($update_res));
72
}
73
74
public
static
function
GetUpdateResult
()
75
{
76
$update_res =
false
;
77
if
(intval(COption::GetOptionString(
'main'
,
'update_autocheck'
)) > 0)
78
$update_res = unserialize(COption::GetOptionString(
'main'
,
'~update_autocheck_result'
), [
'allowed_classes'
=>
false
]);
79
if
(!is_array($update_res))
80
$update_res =
array
(
"result"
=>
false
,
"error"
=>
""
,
"modules"
=>
array
());
81
82
$update_res[
'tooltip'
] =
''
;
83
if
($update_res[
"result"
] ==
true
|| $update_res[
"error"
] <>
''
)
84
{
85
$updOptions = CUtil::GetPopupOptions(
'update_tooltip'
);
86
if
($updOptions[
'display'
] <>
'off'
)
87
{
88
if
($update_res[
"result"
] ==
true
)
89
$update_res[
'tooltip'
] =
GetMessage
(
"top_panel_updates"
).(($n =
count
($update_res[
"modules"
])) > 0?
GetMessage
(
"top_panel_updates_modules"
,
array
(
"#MODULE_COUNT#"
=>
$n
)) :
''
);
90
elseif
($update_res[
"error"
] <>
''
)
91
$update_res[
'tooltip'
] =
GetMessage
(
"top_panel_updates_err"
).
' '
.$update_res[
"error"
].
'<br><a href="/bitrix/admin/settings.php?lang='
.LANGUAGE_ID.
'&mid=main&tabControl_active_tab=edit5">'
.
GetMessage
(
"top_panel_updates_settings"
).
'</a>'
;
92
}
93
}
94
95
return
$update_res;
96
}
97
98
public
static
function
clearUpdatesCacheAgent
()
99
{
100
return
''
;
101
}
102
}
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
UpdateTools
Определения
updatetools.php:8
UpdateTools\SetUpdateResult
static SetUpdateResult()
Определения
updatetools.php:51
UpdateTools\SetUpdateError
static SetUpdateError($strError)
Определения
updatetools.php:61
UpdateTools\GetUpdateResult
static GetUpdateResult()
Определения
updatetools.php:74
UpdateTools\clearUpdatesCacheAgent
static clearUpdatesCacheAgent()
Определения
updatetools.php:98
UpdateTools\CheckUpdates
static CheckUpdates()
Определения
updatetools.php:9
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$strError
$strError
Определения
options_user_settings.php:4
$USER
global $USER
Определения
csv_new_run.php:40
$modules
$modules
Определения
bitrix.php:26
IncludeModuleLangFile
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения
tools.php:3778
GetMessage
GetMessage($name, $aReplace=null)
Определения
tools.php:3397
Bitrix\Main
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
count
</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."%"
Определения
waybill.php:936
$n
$n
Определения
update_log.php:107
bitrix
modules
main
classes
general
updatetools.php
Создано системой
1.14.0