summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
authorChristian Hofmaier2020-12-08 14:16:37 +0100
committerChristian Hofmaier2020-12-08 14:16:37 +0100
commit0480d8aff79fb45034a32d594501cd3d325cb1e2 (patch)
tree7ad14256f23959cc5e4f11a4690cb9ee4fdb9a12 /modules-available/rebootcontrol
parent[locations] Add scheduler to openingtimes modal (diff)
downloadslx-admin-0480d8aff79fb45034a32d594501cd3d325cb1e2.tar.gz
slx-admin-0480d8aff79fb45034a32d594501cd3d325cb1e2.tar.xz
slx-admin-0480d8aff79fb45034a32d594501cd3d325cb1e2.zip
[rebootcontrol] rename scheduler table and associated queries
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r--modules-available/rebootcontrol/inc/scheduler.inc.php24
-rw-r--r--modules-available/rebootcontrol/install.inc.php6
2 files changed, 15 insertions, 15 deletions
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
diff --git a/modules-available/rebootcontrol/install.inc.php b/modules-available/rebootcontrol/install.inc.php
index 6fe040ad..7d4382d0 100644
--- a/modules-available/rebootcontrol/install.inc.php
+++ b/modules-available/rebootcontrol/install.inc.php
@@ -37,10 +37,10 @@ $output[] = tableCreate('reboot_subnet_x_subnet', "
PRIMARY KEY (`srcid`, `dstid`),
KEY `nextcheck` (`nextcheck`)");
-$output[] = tableCreate('scheduler', "
+$output[] = tableCreate('reboot_scheduler', "
`locationid` INT(11) NOT NULL,
`action` ENUM('wol', 'sd'),
- `nextwake` INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ `nextexecution` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`options` BLOB,
PRIMARY KEY (`locationid`, `action`)");
@@ -52,7 +52,7 @@ $output[] = tableAddConstraint('reboot_subnet_x_subnet', 'srcid', 'reboot_subnet
'ON UPDATE CASCADE ON DELETE CASCADE');
$output[] = tableAddConstraint('reboot_subnet_x_subnet', 'dstid', 'reboot_subnet', 'subnetid',
'ON UPDATE CASCADE ON DELETE CASCADE');
-$output[] = tableAddConstraint('scheduler', 'locationid', 'location', 'locationid',
+$output[] = tableAddConstraint('reboot_scheduler', 'locationid', 'location', 'locationid',
'ON UPDATE CASCADE ON DELETE CASCADE');
responseFromArray($output); \ No newline at end of file