diff options
Diffstat (limited to 'modules-available/runmode/page.inc.php')
-rw-r--r-- | modules-available/runmode/page.inc.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules-available/runmode/page.inc.php b/modules-available/runmode/page.inc.php index 0b6dfa02..a551ddc5 100644 --- a/modules-available/runmode/page.inc.php +++ b/modules-available/runmode/page.inc.php @@ -198,15 +198,17 @@ class Page_RunMode extends Page { if ($onlyModule === false) { $where = ''; + $args = []; } else { $where = ' AND r.module = :moduleId '; + $args = ['moduleId' => $onlyModule]; } $res = Database::simpleQuery("SELECT m.machineuuid, m.hostname, m.clientip, r.module, r.modeid, r.isclient" . " FROM runmode r" . " INNER JOIN machine m ON (m.machineuuid = r.machineuuid $where )" - . " ORDER BY m.hostname ASC, m.clientip ASC", array('moduleId' => $onlyModule)); + . " ORDER BY m.hostname ASC, m.clientip ASC", $args); $modules = array(); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { if (!isset($modules[$row['module']])) { if (!Module::isAvailable($row['module'])) continue; @@ -332,7 +334,7 @@ class Page_RunMode extends Page LIMIT 100", $params); $returnObject = [ - 'machines' => $result->fetchAll(PDO::FETCH_ASSOC) + 'machines' => $result->fetchAll() ]; } } |