summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/hooks/cron.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol/hooks/cron.inc.php')
-rw-r--r--modules-available/rebootcontrol/hooks/cron.inc.php19
1 files changed, 13 insertions, 6 deletions
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);
+ }
}
/*