Merge pull request #2408 from SimonFair/Fix-Memory-reporting-error-1TiB

Fix: Memory reporting.
This commit is contained in:
tom mortensen
2025-09-30 13:06:44 -07:00
committed by GitHub

View File

@@ -169,11 +169,16 @@ foreach ($memory_array as $device) {
if ($base>=1) $memory_maximum += $size*pow(1024,$base);
if (!$ecc && isset($device['Error Correction Type']) && $device['Error Correction Type']!='None') $ecc = "{$device['Error Correction Type']} ";
}
if ($memory_installed >= 1048576) {
$memory_installed = round($memory_installed/1048576);
$memory_maximum = round($memory_maximum/1048576);
$unit = 'TiB';
} else {
if ($memory_installed >= 1024) {
$memory_installed = round($memory_installed/1024);
$memory_maximum = round($memory_maximum/1024);
$unit = 'GiB';
} else $unit = 'MiB';
$unit = 'GiB';}
else $unit = 'MiB'; }
// get system resources size
exec("df --output=size /boot /var/log /var/lib/docker 2>/dev/null|awk '(NR>1){print $1*1024}'",$df);