• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/site_checker.php
  • Класс: CSiteCheckerTest
  • Вызов: CSiteCheckerTest::Start
function Start()
{
	$this->test_percent = 100; // by default

	ob_start();
	try
	{
		if ($this->fix_mode && $this->arTestVars['start_function'] != $this->function)
		{
			// dummy hit to display zero progress
			$this->arTestVars['start_function'] = $this->function;
			$this->test_percent = 0;
			$this->result = true;
		}
		else
			$this->result = call_user_func(array($this,$this->function));
	}
	catch (Exception $e)
	{
		$this->Result(null, GetMessage("MAIN_SC_TEST_IS_INCORRECT"));
		echo $e->getMessage();
	}
	$this->strError = ob_get_clean();

	if (!$this->strResult)
		$this->Result($this->result);

	if (!$this->fix_mode)
	{
		// write to log
		if (@$this->OpenLog())
		{
			$text = date('Y-M-d H:i:s') . ' ' . $this->strCurrentTestName . ' (' . $this->function . "): " . $this->LogResult . "n";
			if ($this->test_percent < 100)
				$text .= $this->test_percent.'% done' . "n";

			if ($this->strError)
			{
				$text .= str_replace('
', "n", $this->strError)."n"; } if ($this->test_percent >= 100) // test finished $text .= preg_replace('#<[^<>]+>#','',$this->strResult)."n"; $text = htmlspecialchars_decode($text); fwrite($this->LogResourse, $text); } } $this->last_function = $this->function; $this->percent = floor(($this->step + $this->test_percent / 100) / count($this->arTest) * 100); if ($this->test_percent >= 100) // test finished { if ($this->step + 1 < count($this->arTest)) { $this->step++; $this->test_percent = 0; $this->arTestVars['last_value'] = ''; $this->function = key($this->arTest[$this->step]); $this->strNextTestName = current($this->arTest[$this->step]); } else // finish { if (!$this->fix_mode) // if we have a kernel { COption::SetOptionString('main', 'site_checker_success', $this->arTestVars['site_checker_success'] ?? ''); if (isset($this->arTestVars['site_checker_success']) && $this->arTestVars['site_checker_success'] == 'Y') { CAdminNotify::DeleteByTag('SITE_CHECKER'); } } } } elseif ($this->result === true) $this->strResult = ''; // in case of temporary result on this step if ($this->result === false) $this->arTestVars['site_checker_success'] = 'N'; }