CC-2989: airtime-check-system should deal with the case when the web server is not accessible

This commit is contained in:
Martin Konecny 2011-10-27 16:54:35 -04:00
parent 7c42a2f093
commit aace5d0776

View file

@ -52,7 +52,6 @@ class AirtimeCheck {
$url = "http://localhost/api/status/format/json/api_key/%%api_key%%"; $url = "http://localhost/api/status/format/json/api_key/%%api_key%%";
self::output_status("AIRTIME_STATUS_URL", $url); self::output_status("AIRTIME_STATUS_URL", $url);
$url = str_replace("%%api_key%%", $p_apiKey, $url); $url = str_replace("%%api_key%%", $p_apiKey, $url);
$ch = curl_init($url); $ch = curl_init($url);
@ -105,14 +104,18 @@ class AirtimeCheck {
} }
if (self::$AIRTIME_STATUS_OK){ if (self::$AIRTIME_STATUS_OK){
echo PHP_EOL."-- Your installation of Airtime looks OK!".PHP_EOL; self::output_comment("Your installation of Airtime looks OK!");
exit(0); exit(0);
} else { } else {
echo PHP_EOL."-- There appears to be a problem with your Airtime installation.".PHP_EOL; self::output_comment("There appears to be a problem with your Airtime installation.");
echo "-- Please visit http://wiki.sourcefabric.org/x/HABQ".PHP_EOL; self::output_comment("Please visit http://wiki.sourcefabric.org/x/HABQ");
exit(1); exit(1);
} }
} }
public static function output_comment($comment){
echo PHP_EOL."-- $comment".PHP_EOL;
}
public static function output_status($key, $value){ public static function output_status($key, $value){
global $showColor; global $showColor;