mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
🎨 Display human readable sizes in bytes as int instead of float
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user