diff options
author | Simon Rettberg | 2021-09-21 17:41:11 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-09-21 17:41:11 +0200 |
commit | 8dc88f03f52a03f4b56bc6c14d87eb42e653cb55 (patch) | |
tree | 6a09f84c428f4fa8af0d27b25bb06d88bf4da591 | |
parent | Passthrough WIP (diff) | |
download | slx-admin-8dc88f03f52a03f4b56bc6c14d87eb42e653cb55.tar.gz slx-admin-8dc88f03f52a03f4b56bc6c14d87eb42e653cb55.tar.xz slx-admin-8dc88f03f52a03f4b56bc6c14d87eb42e653cb55.zip |
[statistics/passthrough] Fixes
-rw-r--r-- | modules-available/passthrough/page.inc.php | 6 | ||||
-rw-r--r-- | modules-available/statistics/api.inc.php | 3 | ||||
-rw-r--r-- | modules-available/statistics/inc/hardwareparser.inc.php | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/modules-available/passthrough/page.inc.php b/modules-available/passthrough/page.inc.php index 3913bad0..33f2e4a3 100644 --- a/modules-available/passthrough/page.inc.php +++ b/modules-available/passthrough/page.inc.php @@ -20,7 +20,7 @@ class Page_Passthrough extends Page { $newgroups = Request::post('newgroup', [], 'array'); foreach ($newgroups as $id => $title) { - $id = strtoupper(preg_replace('/[^a-z0-9_\-]/ig', '', $id)); + $id = strtoupper(preg_replace('/[^a-z0-9_\-]/i', '', $id)); if (empty($id)) continue; Database::exec("INSERT IGNORE INTO passthrough_group (groupid, title) @@ -88,8 +88,8 @@ class Page_Passthrough extends Page return hexdec($a) - hexdec($b); }); foreach ($rows as &$row) { - $row['vendor_name'] = PciId::getPciId(PciId::VENDOR, $row['vendor'] ?? ''); - $row['device_name'] = PciId::getPciId(PciId::DEVICE, $row['vendor'] . ':' . $row['device']); + $row['vendor_name'] = PciId::getPciId(PciId::VENDOR, $row['vendor'] ?? '', true); + $row['device_name'] = PciId::getPciId(PciId::DEVICE, $row['vendor'] . ':' . $row['device'], true); } Render::addTemplate('hardware-list', ['list' => $rows]); } diff --git a/modules-available/statistics/api.inc.php b/modules-available/statistics/api.inc.php index e20ae696..749557a6 100644 --- a/modules-available/statistics/api.inc.php +++ b/modules-available/statistics/api.inc.php @@ -342,7 +342,6 @@ if ($type[0] === '~') { 'hwid' => $hwid, 'machineuuid' => $uuid, 'devpath' => $port, - 'serial' => '', ), array('disconnecttime' => 0)); $validProps = array(); if (count($screen) > 1) { @@ -385,7 +384,7 @@ if ($type[0] === '~') { // Some screens connected, make sure old entries get removed Database::exec("UPDATE machine_x_hw x, statistic_hw h SET x.disconnecttime = UNIX_TIMESTAMP() - WHERE (x.hwid, x.devpath) NOT IN (:pairs) AND x.disconnecttime = 0 AND h.hwtype = :type + WHERE (x.hwid, x.devpath) NOT IN (:pairs) AND x.hwid = h.hwid AND x.disconnecttime = 0 AND h.hwtype = :type AND x.machineuuid = :uuid", array( 'pairs' => $keepPair, 'uuid' => $uuid, diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index 87dcc4cf..562c5948 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -538,7 +538,7 @@ class HardwareParser { $ret = []; foreach ($data as $key => $vals) { - $val = trim($vals['values'][0]); + $val = trim($vals['values'][0] ?? 'NULL'); if ($val === '[Empty]' || $val === 'NULL') continue; $val = preg_replace('/[^a-z0-9]/', '', strtolower($val)); @@ -567,7 +567,7 @@ class HardwareParser */ private static function markDisconnected(string $uuid, string $dbType, array $excludedHwIds) { - error_log("Marking disconnected for $dbType from " . implode(', ', $excludedHwIds)); + error_log("Marking disconnected for $dbType except " . implode(', ', $excludedHwIds)); if (empty($excludedHwIds)) { Database::exec("UPDATE machine_x_hw mxh, statistic_hw h SET mxh.disconnecttime = UNIX_TIMESTAMP() |