From 7c42a2f093de3baff42982ea10d9ecf799a9e5c2 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 27 Oct 2011 16:33:10 -0400 Subject: [PATCH] CC-3002: airtime-check-system: make status color optional. -done --- utils/airtime-check-system.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/airtime-check-system.php b/utils/airtime-check-system.php index ffca4cd74..5c98a7844 100644 --- a/utils/airtime-check-system.php +++ b/utils/airtime-check-system.php @@ -4,6 +4,8 @@ AirtimeCheck::ExitIfNotRoot(); $sapi_type = php_sapi_name(); +$showColor = !in_array("--no-color", $argv); + //detect if we are running via the command line if (substr($sapi_type, 0, 3) == 'cli') { //we are running from the command-line @@ -113,6 +115,8 @@ class AirtimeCheck { } public static function output_status($key, $value){ + global $showColor; + $RED = "[0;31m"; $GREEN = "[1;32m"; @@ -123,7 +127,10 @@ class AirtimeCheck { self::$AIRTIME_STATUS_OK = false; } - echo sprintf("%-31s= %s", $key, self::term_color($value, $color)).PHP_EOL; + if ($showColor) + echo sprintf("%-31s= %s", $key, self::term_color($value, $color)).PHP_EOL; + else + echo sprintf("%-31s= %s", $key, $value).PHP_EOL; } public static function term_color($text, $color){