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.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php
index 3651c779..9c6cbaaf 100644
--- a/modules-available/rebootcontrol/hooks/cron.inc.php
+++ b/modules-available/rebootcontrol/hooks/cron.inc.php
@@ -14,10 +14,11 @@ if (in_array((int)date('G'), [6, 7, 9, 12, 15]) && in_array(date('i'), ['00', '0
$now = time();
$res = Database::simpleQuery("SELECT * FROM reboot_scheduler WHERE nextexecution < :now", ['now' => $now]);
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']));
- Scheduler::updateSchedule($row['locationid'], $row['action'], $row['options'], $location['openingtime']);
+ Scheduler::updateSchedule($row['locationid'], $options, $location['openingtime']);
if ($row['nextexecution'] + 1200 < $now) continue;
@@ -27,10 +28,9 @@ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
settype($machine['locationid'], 'int');
$machines[] = $machine;
}
- // Options not yet used.
- $options = json_decode($row['options']);
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);
}
/*