Shares: show "Minimum free space" as absolute number instead of percentage

This commit is contained in:
bergware
2023-07-19 11:40:42 +02:00
parent ba0e21b27f
commit dd503c9552

View File

@@ -62,13 +62,10 @@ function presetSpace($val) {
$pool = _var($shares[$name],'cachePool');
$size = _var($fsSize,$pool,0);
$size = $size>0 ? round(100*$val/$size,1) : 0;
$unit = '%';
if ($size < 1) {
$units = ['KB','MB','GB','TB','PB','EB','ZB','YB'];
$base = $val>0 ? floor(log($val,1000)) : 0;
$size = round($val/pow(1000,$base),1);
$unit = _var($units,$base);
}
$units = ['KB','MB','GB','TB','PB','EB','ZB','YB'];
$base = $val>0 ? floor(log($val,1000)) : 0;
$size = round($val/pow(1000,$base),1);
$unit = _var($units,$base);
[$dot,$comma] = str_split(_var($display,'number','.,'));
return $size>0 ? number_format($size,$size-floor($size)?1:0,$dot,$comma).' '.$unit : '';
}