read num bytes used from file instead of calculating manually

This commit is contained in:
Martin Konecny 2013-01-25 16:36:57 -05:00
parent 3d103aed0f
commit d47469be25

View file

@ -217,9 +217,13 @@ class Application_Model_Systemstatus
//connect to DB and find how much total space user has allocated.
$totalSpace = Application_Model_Preference::GetDiskQuota();
$storPath = Application_Model_MusicDir::getStorDir()->getDirectory();
$path = $_SERVER['AIRTIME_BASE']."etc/airtime/num_bytes.ini";
$arr = parse_ini_file($path);
list($usedSpace,) = preg_split("/[\s]+/", exec("du -bs $storPath"));
$usedSpace = 0;
if ($arr !== false) {
$usedSpace = $arr['num_bytes'];
}
$partitions[$totalSpace]->totalSpace = $totalSpace;
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;