4use \Bitrix\Security\SiteCheckTable;
30 public function __construct($pTests =
array(), $pIsFirstStart =
false, $pIsCheckRequirementsNeeded =
true)
32 $this->isCheckRequirementsNeeded = $pIsCheckRequirementsNeeded;
41 throw new Exception(
'Error while initializing');
55 if(!is_callable($testName,
"check"))
58 $test =
new $testName;
65 if($this->isCheckRequirementsNeeded)
66 $test->checkRequirements($testParams);
68 $result = $test->check($testParams);
73 "name" => $test->getName(),
75 "fatal_error_text" => $exception->getMessage()
98 public static function runTestPackage($pType =
"", $pIsFirstStart =
false, $pIsCheckRequirementsNeeded =
true)
104 $result = $dispatcher->startTesting();
105 $result[
"percent"] = $dispatcher->getPercent();
106 if($dispatcher->isAllTestCompleted())
129 $totalTestsCount =
count($this->neededTests);
130 $remainingTestsCount =
count($this->sessionData->getArray(
"NEEDED_TESTS"));
131 return intval((($totalTestsCount - $remainingTestsCount) / $totalTestsCount) * 100);
142 return SiteCheckTable::getList([
143 'filter' => $pFilter,
144 'order' => [
'ID' =>
'DESC'],
145 'limit' => $pMaxCount
156 if (!isset($pResults) || !is_array($pResults))
159 $now = new \Bitrix\Main\Type\DateTime();
161 $res = SiteCheckTable::add([
163 'RESULTS' => serialize($pResults)
182 $cacheId = self::CACHE_BASE_ID.
"_last_results";
184 if(
$CACHE_MANAGER->read(self::CHECKING_REPEAT_TIME, $cacheId, self::CACHE_DIR))
190 $lastResult =
array();
197 if(checkSerializedData(
$result[
"RESULTS"]))
199 $lastResult[
"results"] = unserialize(
$result[
"RESULTS"], [
'allowed_classes' =>
false]);
204 $lastResult[
"test_date"] =
$result[
"TEST_DATE"];
210 return (is_array($lastResult) ? $lastResult:
array()) ;
218 CSecurityTemporaryStorage::ClearAll();
231 $cacheId = self::CACHE_BASE_ID.
"_last_check";
233 if(
$CACHE_MANAGER->read(self::CHECKING_REPEAT_TIME, $cacheId, self::CACHE_DIR))
239 $minimalDate = new \Bitrix\Main\Type\DateTime();
240 $sec = self::CHECKING_REPEAT_TIME;
241 $minimalDate->add(
"-{$sec} seconds");
243 $res = SiteCheckTable::getList([
244 'select' => [
'COUNT'],
245 'filter' => [
'>=TEST_DATE' => $minimalDate],
246 'runtime' => [
new \
Bitrix\Main\Entity\ExpressionField(
'COUNT',
'COUNT(*)')]
272 return $DB->CharToDateFunction(ConvertTimeStamp($timestamp + CTimeZone::GetOffset(),
"FULL"));
296 $this->sessionData->clearKey(
"STEP");
297 $nextTestName = $this->sessionData->getArrayPop(
"NEEDED_TESTS");
298 if(is_string($nextTestName) && $nextTestName !=
"")
300 $this->sessionData->setData(
"CUR_TEST", $nextTestName);
304 $this->sessionData->setData(
"ALL_DONE",
true);
313 return $this->sessionData->getBool(
"ALL_DONE");
326 if(isset($testingInfo[
"results"]))
328 $results = $testingInfo[
"results"];
337 $results = $pResults;
340 $criticalResultsCount = 0;
344 $criticalResultsCount++;
347 return $criticalResultsCount;
357 if(!
$USER->isAdmin())
360 if(!self::isNewTestNeeded())
365 $adminUrl = self::ADMIN_PAGE_URL.
"?lang=".LANGUAGE_ID;
367<div class="adm-informer-item-section">
368 <span class="adm-informer-item-l">
369 <span>'.GetMessage(
"SEC_CHECKER_INFORMER_DESCRIPTION").
'</span>
373 $WAFAIParams =
array(
374 "TITLE" =>
GetMessage(
"SEC_CHECKER_INFORMER_TITLE"),
378 "FOOTER" =>
'<a href="'.$adminUrl.
'">'.
GetMessage(
"SEC_CHECKER_INFORMER_LINK").
'</a>'
384 $WAFAIParams =
array(
387 "HTML" => $e->getMessage()
400 if($this->sessionData->isEmpty(
"CUR_TEST"))
404 return $this->sessionData->getString(
"CUR_TEST");
414 if(is_array($pParams) && !empty($pParams))
421 "TEST_ID" => md5($pTestName),
432 if($this->sessionData->isExists(
"STEP"))
434 $this->sessionData->increment(
"STEP");
438 $this->sessionData->setData(
"STEP", 0);
440 return $this->sessionData->getInt(
"STEP");
459 if(is_string($pTests) && $pTests !=
"")
461 $this->neededTests =
array($pTests);
463 elseif(is_array($pTests) && !empty($pTests))
465 $this->neededTests = $pTests;
472 if(!$this->sessionData->isExists(
"NEEDED_TESTS"))
474 $this->sessionData->setData(
"NEEDED_TESTS", $this->neededTests);
startTesting($pParams=array())
static getLastTestingInfo()
initializeAvailableTests()
static OnAdminInformerInsertItems()
$isCheckRequirementsNeeded
static runTestPackage($pType="", $pIsFirstStart=false, $pIsCheckRequirementsNeeded=true)
static calculateCriticalResults($pResults=array())
static clearTemporaryData()
initializeNeededTests($pTests)
const CHECKING_REPEAT_TIME
static getList($pFilter=array(), $pMaxCount=1)
static addResults($pResults)
makeParamsForTest($pTestName, $pParams)
__construct($pTests=array(), $pIsFirstStart=false, $pIsCheckRequirementsNeeded=true)
static getFormatedDate($timestamp)
static getTestsPackage($pType="")
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</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."%"