Don't show storage space warning when the free space can't be determined

This commit is contained in:
Robin Appelman 2013-03-15 16:46:20 +01:00
parent 319e3f162c
commit 8a97afac6f
1 changed files with 10 additions and 2 deletions

View File

@ -812,11 +812,19 @@ class OC_Helper {
$used = 0;
}
$free = \OC\Files\Filesystem::free_space();
$total = $free + $used;
if ($free >= 0){
$total = $free + $used;
} else {
$total = $free; //either unknown or unlimited
}
if ($total == 0) {
$total = 1; // prevent division by zero
}
$relative = round(($used / $total) * 10000) / 100;
if ($total >= 0){
$relative = round(($used / $total) * 10000) / 100;
} else {
$relative = 0;
}
return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
}