summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/inc/hardwareparser.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2021-09-24 16:42:50 +0200
committerSimon Rettberg2021-09-24 16:42:50 +0200
commit755cab15d44d5a4e15a9ff0302861dc686e47b57 (patch)
tree9a3c4acd97fe9ad4bc3e4523e75d7d759010f3a2 /modules-available/statistics/inc/hardwareparser.inc.php
parent[statistics/passthrough] WIP (diff)
downloadslx-admin-755cab15d44d5a4e15a9ff0302861dc686e47b57.tar.gz
slx-admin-755cab15d44d5a4e15a9ff0302861dc686e47b57.tar.xz
slx-admin-755cab15d44d5a4e15a9ff0302861dc686e47b57.zip
[statistics/passthrough] WIP
Diffstat (limited to 'modules-available/statistics/inc/hardwareparser.inc.php')
-rw-r--r--modules-available/statistics/inc/hardwareparser.inc.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php
index 5ba1e3dd..55ebbbcc 100644
--- a/modules-available/statistics/inc/hardwareparser.inc.php
+++ b/modules-available/statistics/inc/hardwareparser.inc.php
@@ -630,10 +630,12 @@ class HardwareParser
$globalMainboardExtra['Memory Slot Count'] += $mem['Number Of Devices'];
}
if (isset($mem['Maximum Capacity'])) {
- $globalMainboardExtra['Memory Maximum Capacity'] += self::convertSize($mem['Maximum Capacity'], 'M', false);
+ $globalMainboardExtra['Memory Maximum Capacity']
+ += self::convertSize($mem['Maximum Capacity'], 'M', false);
}
}
- $globalMainboardExtra['Memory Maximum Capacity'] = self::convertSize($globalMainboardExtra['Memory Maximum Capacity'] . ' MB');
+ $globalMainboardExtra['Memory Maximum Capacity']
+ = self::convertSize($globalMainboardExtra['Memory Maximum Capacity'] . ' MB', 'G');
// BIOS section - need to cross-match this with mainboard or system model, as it doesn't have a meaningful
// identifier on its own
$bios = self::prepareDmiProperties(self::getDmiHandles($data, 0)[0]);
@@ -651,8 +653,14 @@ class HardwareParser
}
}
// Using the general helper function
- $ramModCount = self::updateHwTypeFromDmi($uuid, $data, 17, HardwareInfo::RAM_MODULE, function (array $flat): bool {
- return self::convertSize(($flat['Size'] ?? 0), '', false) > 65 * 1024 * 1024;
+ $capa = 0;
+ $ramModCount = self::updateHwTypeFromDmi($uuid, $data, 17, HardwareInfo::RAM_MODULE, function (array $flat) use (&$capa): bool {
+ $size = self::convertSize(($flat['Size'] ?? 0), '', false);
+ if ($size > 65 * 1024 * 1024) {
+ $capa += $size;
+ return true;
+ }
+ return false;
},
['Locator'],
['Data Width',
@@ -669,6 +677,7 @@ class HardwareParser
);
// Fake RAM slots used/total into this
$localMainboardExtra['Memory Slot Occupied'] = $ramModCount;
+ $localMainboardExtra['Memory Installed Capacity'] = self::convertSize($capa, 'G', true);
self::updateHwTypeFromDmi($uuid, $data, 2, HardwareInfo::MAINBOARD, ['Manufacturer', 'Product Name'],
[],
['Manufacturer', 'Product Name', 'Type', 'Version'],