mirror of
https://github.com/itflow-org/itflow
synced 2026-11-21 20:07:24 +00:00
QoL 56: formatBytes as the one file size formatter with one decimal and a unit at 1024, backupFormatBytes calling it, and the portal and setup scripts writing sizes the same way
This commit is contained in:
@@ -1490,12 +1490,5 @@ function backupParseIniBytes($value): int
|
||||
|
||||
function backupFormatBytes($bytes): string
|
||||
{
|
||||
$bytes = floatval($bytes);
|
||||
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
$i = 0;
|
||||
while ($bytes >= 1024 && $i < count($units) - 1) {
|
||||
$bytes /= 1024;
|
||||
$i++;
|
||||
}
|
||||
return round($bytes, $i === 0 ? 0 : 1) . ' ' . $units[$i];
|
||||
return formatBytes($bytes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user