From 778cb1bbe477c7703c5c7a4d112e362091409c0f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 17 Mar 2021 10:49:20 +0100 Subject: [locations/rebootcontrol] Formatting --- modules-available/rebootcontrol/hooks/cron.inc.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'modules-available/rebootcontrol/hooks/cron.inc.php') diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php index 9c6cbaaf..5ae3b1c8 100644 --- a/modules-available/rebootcontrol/hooks/cron.inc.php +++ b/modules-available/rebootcontrol/hooks/cron.inc.php @@ -17,20 +17,27 @@ while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $options = json_decode($row['options'], true); // Calculate next_execution for the event. - $location = Database::queryFirst("SELECT openingtime FROM `location` WHERE locationid = :lid", array('lid' => $row['locationid'])); + $location = Database::queryFirst("SELECT openingtime FROM `location` + WHERE locationid = :lid", ['lid' => $row['locationid']]); Scheduler::updateSchedule($row['locationid'], $options, $location['openingtime']); - if ($row['nextexecution'] + 1200 < $now) continue; + if ($row['nextexecution'] + 1200 < $now) + continue; - $machinedb = Database::simpleQuery("SELECT machineuuid, clientip, macaddr, locationid FROM machine WHERE locationid = :locid", ['locid' => $row['locationid']]); + $machinedb = Database::simpleQuery("SELECT machineuuid, clientip, macaddr, locationid FROM machine + WHERE locationid = :locid", ['locid' => $row['locationid']]); $machines = []; while ($machine = $machinedb->fetch(PDO::FETCH_ASSOC)) { settype($machine['locationid'], 'int'); $machines[] = $machine; } - if ($row['action'] === 'sd') RebootControl::execute($machines, RebootControl::SHUTDOWN, 0); - else if ($row['action'] === 'wol') RebootControl::wakeMachines($machines); - else if ($row['action'] === 'rb') RebootControl::execute($machines, RebootControl::REBOOT, 0); + if ($row['action'] === 'sd') { + RebootControl::execute($machines, RebootControl::SHUTDOWN, 0); + } elseif ($row['action'] === 'wol') { + RebootControl::wakeMachines($machines); + } elseif ($row['action'] === 'rb') { + RebootControl::execute($machines, RebootControl::REBOOT, 0); + } } /* -- cgit v1.2.3-55-g7522