• Модуль: bitrixcloud
  • Путь к файлу: ~/bitrix/modules/bitrixcloud/classes/general/monitoring.php
  • Класс: CBitrixCloudMonitoring
  • Вызов: CBitrixCloudMonitoring::getWorstUptime
public function getWorstUptime($testId = "", $domainName = "")
{
	$result = "";
	$maxDiff = 0;

	if ($this->result)
	{
		if ($domainName === "")
		{
			foreach ($this->result as $domainName => $domainResult)
			{
				foreach ($domainResult as $testId => $testResult)
				{
					if (
						($testId === "" || $testId === $testResult->getName())
						&& $testResult->getStatus() === CBitrixCloudMonitoringResult::RED_LAMP
					)
					{
						if ($testResult->getUptime())
						{
							$uptime = explode("/", $testResult->getUptime());
							$diff = $uptime[1] - $uptime[0];
							if ($diff > $maxDiff)
							{
								$maxDiff = $diff;
								$result = $testResult->getUptime();
							}
						}
					}
				}
			}
		}
		elseif (is_array($this->result[$domainName]))
		{
			foreach ($this->result[$domainName] as $testId => $testResult)
			{
				if (
					($testId === "" || $testId === $testResult->getName())
					&& $testResult->getStatus() === CBitrixCloudMonitoringResult::RED_LAMP
				)
				{
					if ($testResult->getUptime())
					{
						$uptime = explode("/", $testResult->getUptime());
						$diff = $uptime[1] - $uptime[0];
						if ($diff > $maxDiff)
						{
							$maxDiff = $diff;
							$result = $testResult->getUptime();
						}
					}
				}
			}
		}
	}

	return $result;
}