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:
johnnyq
2026-11-21 01:18:24 -05:00
parent 4265db34b6
commit 79078d1c5c
5 changed files with 19 additions and 19 deletions

View File

@@ -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);
}