summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol/inc')
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php6
-rw-r--r--modules-available/rebootcontrol/inc/rebootutils.inc.php4
-rw-r--r--modules-available/rebootcontrol/inc/scheduler.inc.php4
3 files changed, 7 insertions, 7 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index da1dd69a..71801f1a 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -167,7 +167,7 @@ class RebootControl
if (!empty($invalid)) {
$res = Database::simpleQuery('SELECT machineuuid, clientip, locationid FROM machine WHERE machineuuid IN (:uuids)',
['uuids' => array_keys($invalid)]);
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
if (isset($invalid[$row['machineuuid']])) {
$valid[] = $row + $invalid[$row['machineuuid']];
} else {
@@ -300,7 +300,7 @@ class RebootControl
// Need all subnets...
$subnets = [];
$res = Database::simpleQuery('SELECT subnetid, start, end, isdirect FROM reboot_subnet');
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
$row += [
'jumphosts' => [],
'direct' => [],
@@ -317,7 +317,7 @@ class RebootControl
LEFT JOIN reboot_subnet s ON (INET_ATON(jh.host) BETWEEN s.start AND s.end)
LEFT JOIN reboot_subnet_x_subnet sxs ON (sxs.srcid = s.subnetid AND sxs.reachable <> 0)
GROUP BY jh.hostid');
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
if ($row['subnets1'] === null && $row['subnets2'] === null)
continue;
$nets = explode(',', $row['subnets1'] . ',' . $row['subnets2']);
diff --git a/modules-available/rebootcontrol/inc/rebootutils.inc.php b/modules-available/rebootcontrol/inc/rebootutils.inc.php
index 99235e8a..f6843150 100644
--- a/modules-available/rebootcontrol/inc/rebootutils.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootutils.inc.php
@@ -18,9 +18,9 @@ class RebootUtils
$res = Database::simpleQuery("SELECT $columns FROM machine
WHERE machineuuid IN (:list)", compact('list'));
if (!$assoc)
- return $res->fetchAll(PDO::FETCH_ASSOC);
+ return $res->fetchAll();
$ret = [];
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
$ret[$row['machineuuid']] = $row;
}
return $ret;
diff --git a/modules-available/rebootcontrol/inc/scheduler.inc.php b/modules-available/rebootcontrol/inc/scheduler.inc.php
index 292529fa..7da4b46b 100644
--- a/modules-available/rebootcontrol/inc/scheduler.inc.php
+++ b/modules-available/rebootcontrol/inc/scheduler.inc.php
@@ -117,7 +117,7 @@ class Scheduler
$res = Database::simpleQuery("SELECT s.locationid, s.action, s.nextexecution, s.options
FROM reboot_scheduler s
WHERE s.nextexecution < :now AND s.nextexecution > 0", ['now' => $now]);
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
// Calculate next_execution for the event and update DB.
$options = json_decode($row['options'], true);
// Determine proper opening times by waling up tree
@@ -269,7 +269,7 @@ class Scheduler
LEFT JOIN reboot_scheduler rs USING (locationid)
WHERE l.locationid IN (:list)", ['list' => $childIdList]);
$locationData = [];
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
$locationData[$row['locationid']] = $row;
}
// Handle all child locations