From e12a02856e49ce3f18bc49080dd442bed06e868e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 21 Sep 2020 11:30:14 +0200 Subject: [statistics] Show if current runmode is different from configured one This isn't accounting for fake runmodes like "remoteaccess" or "exams", which aren't stored in the database, but actually, this might be beneficial, as you want to actually see if the clients are in this mode. --- modules-available/statistics/pages/list.inc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules-available/statistics/pages/list.inc.php') diff --git a/modules-available/statistics/pages/list.inc.php b/modules-available/statistics/pages/list.inc.php index 2dab152d..9f2df897 100644 --- a/modules-available/statistics/pages/list.inc.php +++ b/modules-available/statistics/pages/list.inc.php @@ -40,7 +40,8 @@ class SubPage } } $res = Database::simpleQuery("SELECT m.machineuuid, m.locationid, m.macaddr, m.clientip, m.lastseen, - m.logintime, m.state, m.currentuser, m.realcores, m.mbram, m.kvmstate, m.cpumodel, m.id44mb, m.hostname, m.notes IS NOT NULL AS hasnotes, + m.logintime, m.state, m.currentuser, m.currentrunmode, m.realcores, m.mbram, m.kvmstate, m.cpumodel, m.id44mb, + m.hostname, m.notes IS NOT NULL AS hasnotes, m.badsectors, Count(s.machineuuid) AS confvars $xtra FROM machine m LEFT JOIN setting_machine s USING (machineuuid) $join WHERE $where GROUP BY m.machineuuid", $args); @@ -101,6 +102,16 @@ class SubPage unset($row['currentuser']); } } + if ($row['state'] === 'IDLE' || $row['state'] === 'OCCUPIED') { + if ((!empty($row['currentrunmode']) || !empty($row['rmmodule'])) + && $row['currentrunmode'] !== $row['rmmodule']) { + $row['wrongRunMode'] = true; + if (!empty($row['currentrunmode'])) { + $wrongModule = Module::get($row['currentrunmode']); + $row['currentrunmode'] = $wrongModule === false ? $row['currentrunmode'] : $wrongModule->getDisplayName(); + } + } + } $row['state_' . $row['state']] = true; if ($row['locationid'] > 0) { $row['location'] = $location[$row['locationid']]; -- cgit v1.2.3-55-g7522