diff options
author | Simon Rettberg | 2022-05-21 12:38:16 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-21 12:38:16 +0200 |
commit | db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e (patch) | |
tree | 441737aa92b4f27c8d0e0030bbb3096b98717f39 /modules-available/rebootcontrol | |
parent | .idea: Silence annoying inspection (diff) | |
download | slx-admin-db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e.tar.gz slx-admin-db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e.tar.xz slx-admin-db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e.zip |
[remoteaccess] Mark locations that have access restrictions in place
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r-- | modules-available/rebootcontrol/inc/scheduler.inc.php | 10 |
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; } |