summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages
diff options
context:
space:
mode:
authorSimon Rettberg2021-11-26 11:37:59 +0100
committerSimon Rettberg2022-03-09 15:06:54 +0100
commit3368128c0089fa0cef64fc6cbbfc053dbf8fc869 (patch)
tree55ce41043eb2ddf5cdc50949f46ff06fbe480da4 /modules-available/statistics/pages
parent[eventlog] Allow filtering by select hardware info (to be extended) (diff)
downloadslx-admin-3368128c0089fa0cef64fc6cbbfc053dbf8fc869.tar.gz
slx-admin-3368128c0089fa0cef64fc6cbbfc053dbf8fc869.tar.xz
slx-admin-3368128c0089fa0cef64fc6cbbfc053dbf8fc869.zip
[statistics] Add lookup table for GPT type UUIDs
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r--modules-available/statistics/pages/machine.inc.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php
index b23db721..019b0d8d 100644
--- a/modules-available/statistics/pages/machine.inc.php
+++ b/modules-available/statistics/pages/machine.inc.php
@@ -528,7 +528,7 @@ class SubPage
$used += $part['size'];
$lastEnd = $part['start'] + $part['size'];
if (!isset($part['name'])) {
- $part['name'] = self::mbrType($part['slxtype'] ?? $part['type']);
+ $part['name'] = self::partTypeToName($part['slxtype'] ?? $part['type']);
}
}
$dist = $hdd['size'] - $lastEnd;
@@ -651,7 +651,11 @@ class SubPage
return $retval;
}
- private static function mbrType(string $type): string
+ /**
+ * @param string $type MBR-type or GPT UUID
+ * @return string Name of partition type if known, otherwise, $type is returned
+ */
+ private static function partTypeToName(string $type): string
{
switch ($type) {
case '44':
@@ -666,7 +670,7 @@ class SubPage
case 'ef':
return 'EFI';
}
- return $type;
+ return HardwareInfo::GPT[$type] ?? $type;
}
} \ No newline at end of file