diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index b97ea491e..dcb5c1dac 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -214,27 +214,20 @@ class Application_Model_Systemstatus public static function GetDiskInfo() { $partitions = array(); - - //connect to DB and find how much total space user has allocated. - $totalSpace = Application_Model_Preference::GetDiskQuota(); - - $usedSpace = Application_Model_Preference::getDiskUsage(); - if (empty($usedSpace)) { - $usedSpace = 0; + /* First lets get all the watched directories. Then we can group them + * into the same partitions by comparing the partition sizes. */ + $musicDirs = Application_Model_MusicDir::getWatchedDirs(); + $musicDirs[] = Application_Model_MusicDir::getStorDir(); + foreach ($musicDirs as $md) { + $totalSpace = disk_total_space($md->getDirectory()); + if (!isset($partitions[$totalSpace])) { + $partitions[$totalSpace] = new StdClass; + $partitions[$totalSpace]->totalSpace = $totalSpace; + $partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory()); + $partitions[$totalSpace]->usedSpace = $totalSpace - $partitions[$totalSpace]->totalFreeSpace; + } + $partitions[$totalSpace]->dirs[] = $md->getDirectory(); } - /* $path = $_SERVER['AIRTIME_BASE']."etc/airtime/num_bytes.ini"; - $arr = parse_ini_file($path); - - $usedSpace = 0; - if ($arr !== false) { - $usedSpace = $arr['num_bytes']; - } */ - - $partitions[$totalSpace] = new stdClass(); - $partitions[$totalSpace]->totalSpace = $totalSpace; - $partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace; - //Logging::info($partitions[$totalSpace]->totalFreeSpace); - return array_values($partitions); } diff --git a/airtime_mvc/application/views/scripts/systemstatus/index.phtml b/airtime_mvc/application/views/scripts/systemstatus/index.phtml index 1958f404b..9fa27d378 100644 --- a/airtime_mvc/application/views/scripts/systemstatus/index.phtml +++ b/airtime_mvc/application/views/scripts/systemstatus/index.phtml @@ -17,12 +17,6 @@ $r1 = array_reduce($phpDependencies, "booleanReduce", true); $r2 = array_reduce($externalServices, "booleanReduce", true); $result = $r1 && $r2; - - // Disk information. We only use the [0]th index - // because we don't have Watched/Media Folders - $disk = $this->status->partitions[0]; - $used = $disk->totalSpace-$disk->totalFreeSpace; - $total = $disk->totalSpace; ?>
-
|
- - - | -
-
-
-
- ;">
-
- |
-