From ddb6cdc797eb1975ee4bbb04738e20a4a665a60b Mon Sep 17 00:00:00 2001 From: lduer Date: Fri, 19 Feb 2016 16:02:59 +0100 Subject: [PATCH] added isset-check to prevent the errors in issue #34 --- build/statuspage/statusPage.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build/statuspage/statusPage.php b/build/statuspage/statusPage.php index cbb235d..45ed3df 100644 --- a/build/statuspage/statusPage.php +++ b/build/statuspage/statusPage.php @@ -7,6 +7,7 @@ class statusPage public function getChecks($action = null) { $cache = phpFastCache(); + $allCheckInfo = array(); $allChecks = $cache->get('statuspage-allChecks'); if ($allChecks === null) { @@ -47,6 +48,7 @@ public function updateCache($action) $cache = phpFastCache(); $checksArray = $this->getChecksJson($action); $excludedMonitors = unserialize(constant('excludedMonitors')); + $allCheckID = array(); if(count($checksArray['monitors']['monitor'])){ foreach ($checksArray['monitors']['monitor'] as $key => $check) { @@ -57,7 +59,7 @@ public function updateCache($action) $fixedResponseTimes = array(); $fixedEventTime = array(); - if (is_array($check['responsetime'])) { + if (isset($check['responsetime']) && is_array($check['responsetime'])) { foreach ($check['responsetime'] as $key => $restime) { $fixedResponseTimes[] = array( @@ -68,9 +70,7 @@ public function updateCache($action) } - if (!is_null($check['log'])){ - - + if (isset($check['log']) && !is_null($check['log'])){ foreach ($check['log'] as $key => $dt) { $fixedEventTime[] = array( @@ -92,10 +92,14 @@ public function updateCache($action) 'allUpTimeRatio' => $check['alltimeuptimeratio'], 'customUptimeRatio' => explode("-", $check['customuptimeratio']), 'log' => $fixedEventTime, - 'responseTime' => $fixedResponseTimes, - 'timezone' => intval($checksArray['timezone']), - 'currentTime' => time() + (intval($checksArray['timezone']))* 60 + 'responseTime' => $fixedResponseTimes ); + + if (isset($check['timezone'])) { + $tempCheck['timezone'] = intval($checksArray['timezone']); + $tempCheck['currentTime'] = time() + (intval($checksArray['timezone']))* 60; + } + $cache->set('statuspage-' . $check['id'], $tempCheck, constant('cacheTime')); } }