From 5f56538bffb7a35d9da78a50644b1f8e33a00cb0 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 31 Aug 2011 12:52:12 -0400 Subject: [PATCH] CC-2363: Diagnostic screen in Web UI -show hard drive space for /srv/airtime/stor --- .../application/models/Systemstatus.php | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index 665a327b9..116bfa5c8 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -4,19 +4,23 @@ class Application_Model_Systemstatus { private function getCheckSystemResults(){ - exec("airtime-check-system", $output); + //exec("airtime-check-system", $output); - //require_once "/usr/lib/airtime/utils/airtime-check-system.php"; + require_once "/usr/lib/airtime/utils/airtime-check-system.php"; + $arrs = AirtimeCheck::CheckAirtimeDaemons(); - $status = array(); - foreach($output as $row){ - $row = trim($row); - if (substr_count($row, "=") == 1 && "--" != substr($row, 0, 2)){ - list($key, $value) = array_map("trim", explode("=", $row)); - $status[$key] = $value; - } + $status = array("AIRTIME_VERSION" => AIRTIME_VERSION); + foreach($arrs as $arr){ + $status[$arr[0]] = $arr[1]; } + $storDir = MusicDir::getStorDir()->getDirectory(); + + $freeSpace = disk_free_space($storDir); + $totalSpace = disk_total_space($storDir); + + $status["DISK_SPACE"] = sprintf("%01.3f%%", $freeSpace/$totalSpace*100); + return $status; } @@ -37,6 +41,9 @@ class Application_Model_Systemstatus $results[$key] = array($desc, $this->convertRunTimeToPassFail($keyValues[$key]), $downloadLog); } + $key = "DISK_SPACE"; + $results[$key] = array("Disk Space Free: ", $keyValues[$key], false); + return $results; }