From 0480d8aff79fb45034a32d594501cd3d325cb1e2 Mon Sep 17 00:00:00 2001 From: Christian Hofmaier Date: Tue, 8 Dec 2020 14:16:37 +0100 Subject: [rebootcontrol] rename scheduler table and associated queries --- .../rebootcontrol/inc/scheduler.inc.php | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'modules-available/rebootcontrol/inc/scheduler.inc.php') diff --git a/modules-available/rebootcontrol/inc/scheduler.inc.php b/modules-available/rebootcontrol/inc/scheduler.inc.php index 839d7d81..0776885d 100644 --- a/modules-available/rebootcontrol/inc/scheduler.inc.php +++ b/modules-available/rebootcontrol/inc/scheduler.inc.php @@ -8,45 +8,45 @@ class Scheduler self::deleteSchedule($locationid, $action); return false; } - $nextwake = self::calcNextwake($action, $openingTimes); + $nextexec = self::calcNextexec($action, $openingTimes); $json_options = json_encode($options); - self::upsert($locationid, $action, $nextwake, $json_options); + self::upsert($locationid, $action, $nextexec, $json_options); return true; } public static function deleteSchedule($locationid, $action) { - Database::exec("DELETE FROM `scheduler` + Database::exec("DELETE FROM `reboot_scheduler` WHERE locationid = :lid AND action = :act", array( 'lid' => $locationid, 'act' => $action )); } - private static function calcNextwake($action, $openingTimes) { - //TODO: Calculate nextWake based on openingTimes. Needs action to know if openTimes or closingTimes are used. + private static function calcNextexec($action, $openingTimes) { + //TODO: Calculate nextExec based on openingTimes. Needs action to know if openTimes or closingTimes are used. return 0; } - private static function upsert($locationid, $action, $nextwake, $options) { + private static function upsert($locationid, $action, $nextexec, $options) { $schedule = Database::queryFirst("SELECT locationid, action - FROM `scheduler` + FROM `reboot_scheduler` WHERE locationid = :lid AND action = :act", array( 'lid' => $locationid, 'act' => $action )); if ($schedule === false) { - Database::exec("INSERT INTO `scheduler` (locationid, action, nextwake, options) + Database::exec("INSERT INTO `reboot_scheduler` (locationid, action, nextexecution, options) VALUES (:lid, :act, :next, :opt)", array( 'lid' => $locationid, 'act' => $action, - 'next' => $nextwake, + 'next' => $nextexec, 'opt' => $options )); } else { - Database::exec("UPDATE `scheduler` - SET nextwake = :next, options = :opt + Database::exec("UPDATE `reboot_scheduler` + SET nextexecution = :next, options = :opt WHERE locationid = :lid AND action = :act", array( - 'next' => $nextwake, + 'next' => $nextexec, 'opt' => $options, 'lid' => $locationid, 'act' => $action -- cgit v1.2.3-55-g7522