diff options
Diffstat (limited to 'modules-available/rebootcontrol/hooks/cron.inc.php')
-rw-r--r-- | modules-available/rebootcontrol/hooks/cron.inc.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php index 8f5c73a0..73de020d 100644 --- a/modules-available/rebootcontrol/hooks/cron.inc.php +++ b/modules-available/rebootcontrol/hooks/cron.inc.php @@ -5,7 +5,7 @@ */ if (in_array((int)date('G'), [6, 7, 9, 12, 15]) && in_array(date('i'), ['00', '01', '02', '03'])) { $res = Database::simpleQuery('SELECT hostid, host, port, username, sshkey, script FROM reboot_jumphost'); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { RebootControl::wakeViaJumpHost($row, '255.255.255.255', [['macaddr' => '00:11:22:33:44:55']]); } } @@ -171,7 +171,7 @@ if ($res->rowCount() === 0) return; Stuff::$subnets = []; -while ($row = $res->fetch(PDO::FETCH_ASSOC)) { +foreach ($res as $row) { if (!isset(Stuff::$subnets[$row['subnetid']])) { Stuff::$subnets[$row['subnetid']] = []; } @@ -194,7 +194,7 @@ $res = Database::simpleQuery("SELECT subnetid FROM reboot_subnet WHERE subnetid IN (:active) AND nextdirectcheck < UNIX_TIMESTAMP() AND fixed = 0 ORDER BY nextdirectcheck ASC LIMIT 10", ['active' => array_keys(Stuff::$subnets)]); cron_log('Direct checks: ' . $res->rowCount() . ' (' . implode(', ', array_keys(Stuff::$subnets)) . ')'); -while ($row = $res->fetch(PDO::FETCH_ASSOC)) { +foreach ($res as $row) { $dst = (int)$row['subnetid']; cron_log('Direct check for subnetid ' . $dst); $result = testServerToClient($dst); @@ -239,7 +239,7 @@ if (count($combos) > 0) { ORDER BY sxs.nextcheck ASC LIMIT 10", ['combos' => $combos]); cron_log('C2C checks: ' . $res->rowCount()); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { $src = (int)$row['srcid']; $dst = (int)$row['dstid']; $result = testClientToClient($src, $dst); |