summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r--modules-available/rebootcontrol/inc/scheduler.inc.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules-available/rebootcontrol/inc/scheduler.inc.php b/modules-available/rebootcontrol/inc/scheduler.inc.php
index 9e91df25..de6251d2 100644
--- a/modules-available/rebootcontrol/inc/scheduler.inc.php
+++ b/modules-available/rebootcontrol/inc/scheduler.inc.php
@@ -204,10 +204,12 @@ class Scheduler
*/
public static function getLocationOptions(int $id): array
{
- $res = Database::queryFirst("SELECT options FROM `reboot_scheduler`
- WHERE locationid = :id", ['id' => $id]);
- if ($res !== false) {
- return (json_decode($res['options'], true) ?? []) + self::SCHEDULE_OPTIONS_DEFAULT;
+ static $optionList = false;
+ if ($optionList === false) {
+ $optionList = Database::queryKeyValueList("SELECT locationid, `options` FROM `reboot_scheduler`");
+ }
+ if (isset($optionList[$id])) {
+ return (json_decode($optionList[$id]['options'], true) ?? []) + self::SCHEDULE_OPTIONS_DEFAULT;
}
return self::SCHEDULE_OPTIONS_DEFAULT;
}