1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
monitoring_webservice.php
См. документацию.
1<?php
3
4require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/classes/general/update_client.php';
5
7{
8 private $addParams = [];
9 private $addStr = '';
10
18 protected function getActionURL($arParams = /*.(array[string]string).*/ [])
19 {
21
22 $arParams['license'] = md5(LICENSE_KEY);
23 $arParams['lang'] = LANGUAGE_ID;
24 $arParams['region'] = $license->getRegion();
25 $arParams['spd'] = CUpdateClient::getSpd();
26 $arParams['CHHB'] = $_SERVER['HTTP_HOST'];
27 $arParams['CSAB'] = $_SERVER['SERVER_ADDR'];
28 foreach ($this->addParams as $key => $value)
29 {
30 $arParams[$key] = $value;
31 }
32
33 $url = COption::GetOptionString('bitrixcloud', 'monitoring_policy_url') ?: $license->getDomainStoreLicense() . '/monitoring.php';
34 $url = (new \Bitrix\Main\Web\Uri($url))->addParams($arParams)->getUri() . $this->addStr;
35
36 return $url;
37 }
38
46 protected function monitoring_action($action)
47 {
48 $obXML = $this->action($action);
49 /* @var CDataXMLNode $node */
50 $node = $obXML->SelectNodes('/control');
51 if (is_object($node))
52 {
53 $spd = $node->getAttribute('crc_code');
54 if ($spd <> '')
55 {
56 CUpdateClient::setSpd($spd);
57 }
58 }
59 else
60 {
61 throw new CBitrixCloudException(GetMessage('BCL_MON_WS_SERVER', [
62 '#STATUS#' => '-1',
63 ]), $this->getServerResult());
64 }
65
66 return $obXML;
67 }
68
74 public function actionGetList()
75 {
76 $this->addStr = '';
77 $this->addParams = [
78 'lang' => LANGUAGE_ID,
79 ];
80
81 return $this->monitoring_action('monitoring_get_list');
82 }
83
89 public function actionStart($domain, $is_https, $language_id, $emails, $tests)
90 {
91 $this->addStr = '';
92 $this->addParams = [
93 'domain' => $domain,
94 'domain_is_https' => $is_https ? 'Y' : 'N',
95 'lang' => $language_id,
96 ];
97
98 if (is_array($emails))
99 {
100 foreach ($emails as $email)
101 {
102 $email = trim($email);
103 if ($email !== '')
104 {
105 $this->addStr .= '&ar_emails[]=' . urlencode($email);
106 }
107 }
108 }
109
110 if (is_array($tests))
111 {
112 foreach ($tests as $test)
113 {
114 $test = trim($test);
115 if ($test !== '')
116 {
117 $this->addStr .= '&ar_tests[]=' . urlencode($test);
118 }
119 }
120 }
121
122 $option = CBitrixCloudOption::getOption('monitoring_devices');
123 $devices = $option->getArrayValue();
124 foreach ($devices as $domain_device)
125 {
126 if (list ($myDomain, $myDevice) = explode('|', $domain_device, 2))
127 {
128 if ($myDomain === $domain)
129 {
130 $this->addStr .= '&ar_devices[]=' . urlencode($myDevice);
131 }
132 }
133 }
134
135 $this->monitoring_action('monitoring_start');
136 }
137
143 public function actionStop($domain)
144 {
145 $this->addStr = '';
146 $this->addParams = [
147 'domain' => $domain,
148 'lang' => LANGUAGE_ID,
149 ];
150
151 return $this->monitoring_action('monitoring_stop');
152 }
153
159 public function actionGetInfo()
160 {
161 $this->addStr = '';
162 $this->addParams = [
163 'lang' => LANGUAGE_ID,
164 'interval' => COption::GetOptionString('bitrixcloud', 'monitoring_interval'),
165 ];
166
167 return $this->monitoring_action('monitoring_get_info');
168 }
169}
$arParams
Определения access_dialog.php:21
static getInstance()
Определения application.php:98
getActionURL($arParams=[])
Определения monitoring_webservice.php:18
actionStart($domain, $is_https, $language_id, $emails, $tests)
Определения monitoring_webservice.php:89
static getOption($name)
Определения option.php:25
getServerResult()
Определения webservice.php:151
action($action)
Определения webservice.php:26
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
$emails
Определения mail_entry.php:72
if(file_exists(( $_fname=__DIR__ . "/classes/general/update_db_updater.php"))) if(($_fname=getLocalPath("init.php")) !==false) if(( $_fname=getLocalPath("php_interface/init.php", BX_PERSONAL_ROOT)) !==false) if(($_fname=getLocalPath("php_interface/" . SITE_ID . "/init.php", BX_PERSONAL_ROOT)) !==false) if((!(defined("STATISTIC_ONLY") &&STATISTIC_ONLY &&!str_starts_with( $GLOBALS["APPLICATION"]->GetCurPage(), BX_ROOT . "/admin/"))) &&COption::GetOptionString("main", "include_charset", "Y")=="Y" &&LANG_CHARSET !='') if(COption::GetOptionString("main", "set_p3p_header", "Y")=="Y") $license
Определения include.php:158
const LICENSE_KEY($show_sql_stat=='Y')
Определения start.php:84
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
$email
Определения payment.php:49
if(empty($signedUserToken)) $key
Определения quickway.php:257
$option
Определения options.php:1711
$action
Определения file_dialog.php:21
$url
Определения iframe.php:7