From edcce7432dd706f1d8ffb1bf14d6fa9a0fb2e515 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 3 Apr 2012 17:38:59 -0400 Subject: [PATCH] CC-3409: System status page times out if monit is not running. -Fixed --- airtime_mvc/application/models/Systemstatus.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index 69f229b9c..18761dc96 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -11,14 +11,18 @@ class Application_Model_Systemstatus curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERPWD, "guest:airtime"); + //wait a max of 3 seconds before aborting connection attempt + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); $result = curl_exec($ch); curl_close($ch); $docRoot = null; - if ($result != ""){ - $xmlDoc = new DOMDocument(); - $xmlDoc->loadXML($result); - $docRoot = $xmlDoc->documentElement; + if ($result != FALSE){ + if ($result != ""){ + $xmlDoc = new DOMDocument(); + $xmlDoc->loadXML($result); + $docRoot = $xmlDoc->documentElement; + } } return $docRoot;