public static function output_status($key, $value) { global $showColor; $RED = "[0;31m"; $ORANGE = "[0;33m"; $GREEN = "[1;32m"; $color = $GREEN; if ($value == "FAILED") { $color = $RED; self::$AIRTIME_STATUS_OK = false; } else { if ($value == "NOT MONITORED") { $color = $ORANGE; self::$AIRTIME_STATUS_OK = false; } } 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 CheckApacheVHostFiles() { $fileNames = array("/etc/apache2/sites-available/airtime", "/etc/apache2/sites-enabled/airtime"); $status = AirtimeCheck::CHECK_OK; foreach ($fileNames as $fn) { if (!file_exists($fn)) { $status = AirtimeCheck::CHECK_FAILED; self::$check_system_ok = false; } } //Since apache2 loads config files in alphabetical order //from the sites-enabled directory, we need to check if //airtime is lexically the first file in this directory. //get sorted array of files $arr = scandir("/etc/apache2/sites-enabled"); /* foreach ($arr as $a){ if ($a == "." || $a == ".."){ continue; } if ($a == "airtime"){ break; } else { echo "\t\t*Warning, the file \"$a\" is lexically ahead of the file \"airtime\" in".PHP_EOL; echo"\t\t /etc/apache2/sites-enabled and preventing airtime from being loaded".PHP_EOL; } } */ }