Merge remote-tracking branch 'origin/support/3.2' into develop

This commit is contained in:
Pierre Goiffon
2024-03-13 09:28:07 +01:00
3 changed files with 27 additions and 7 deletions

View File

@@ -990,9 +990,18 @@ class SetupUtils
return $f;
}
/**
* @param float $fBytes size in raw bytes, for example 162594750464.0
* @return string formatted string, for example "161.62 GB"
*
* @link https://en.wiktionary.org/wiki/byte byte and not Byte
* @link https://en.wikipedia.org/wiki/Kilobyte kB and not KB (IEC 80000-13)
* @link https://en.wiktionary.org/wiki/petabyte petabyte PB
* @link https://en.wiktionary.org/wiki/exabyte exabyte EB
*/
public static function HumanReadableSize($fBytes)
{
$aSizes = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'HB');
$aSizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB');
$index = 0;
while (($fBytes > 1000) && ($index < count($aSizes))) {
$index++;