🎨 Display human readable sizes in bytes as int instead of float

This commit is contained in:
Eric
2021-06-30 11:18:08 +02:00
parent aa9ab1ace5
commit c7d87ad5b0

View File

@@ -984,12 +984,16 @@ class SetupUtils
{
$aSizes = array('bytes', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Hb');
$index = 0;
while (($fBytes > 1000) && ($index < count($aSizes)))
{
while (($fBytes > 1000) && ($index < count($aSizes))) {
$index++;
$fBytes = $fBytes / 1000;
}
if ($index == 0) {
// display int for bytes
return sprintf('%d %s', $fBytes, $aSizes[$index]);
}
return sprintf('%.2f %s', $fBytes, $aSizes[$index]);
}