SAAS-135: Airtime status page reporting free space being incorrectly for Gluster FS mounts
-Done
This commit is contained in:
parent
00a05e146b
commit
7247f75563
2 changed files with 41 additions and 16 deletions
|
@ -184,24 +184,37 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
|
||||
public static function GetDiskInfo(){
|
||||
/* First lets get all the watched directories. Then we can group them
|
||||
* into the same paritions by comparing the partition sizes. */
|
||||
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
||||
|
||||
|
||||
$partions = array();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
if (isset($_SERVER['AIRTIME_SRV'])){
|
||||
//connect to DB and find how much total space user has allocated.
|
||||
$totalSpace = Application_Model_Preference::GetDiskQuota();
|
||||
|
||||
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
||||
$storPath = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||
|
||||
list($usedSpace,) = preg_split("/[\s]+/", exec("du -s $storPath"));
|
||||
|
||||
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
|
||||
Logging::log($partitions[$totalSpace]->totalFreeSpace);
|
||||
} else {
|
||||
/* 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]->dirs[] = $md->getDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
return array_values($partitions);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue