From 6ca7cb6d7e8774a330ead034eab0c944d5d6ea37 Mon Sep 17 00:00:00 2001 From: abhinavgandham Date: Tue, 20 Jan 2026 15:06:49 +1000 Subject: [PATCH] Issue #390: Reverted new 'Force off' option and dropdown conversion. --- classes/form/outage/edit.php | 9 ++------- db/upgrade.php | 9 +++++++++ lang/en/auth_outage.php | 3 --- settings.php | 12 ------------ 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/classes/form/outage/edit.php b/classes/form/outage/edit.php index 1b13fd8..8fe1b1d 100644 --- a/classes/form/outage/edit.php +++ b/classes/form/outage/edit.php @@ -48,11 +48,6 @@ class edit extends moodleform { $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); - if (get_config('auth_outage', 'default_autostart') !== '2') { - $mform->addElement('checkbox', 'autostart', get_string('autostart', 'auth_outage')); - $mform->addHelpButton('autostart', 'autostart', 'auth_outage'); - } - $mform->addElement('duration', 'warningduration', get_string('warningduration', 'auth_outage')); $mform->addHelpButton('warningduration', 'warningduration', 'auth_outage'); @@ -141,7 +136,7 @@ class edit extends moodleform { } $outagedata = [ 'id' => ($data->id === 0) ? null : $data->id, - 'autostart' => (isset($data->autostart) && ($data->autostart == 1)), + // 'autostart' => (isset($data->autostart) && ($data->autostart == 1)), 'starttime' => $data->starttime, 'stoptime' => $data->starttime + $data->outageduration, 'warntime' => $data->starttime - $data->warningduration, @@ -166,7 +161,7 @@ class edit extends moodleform { if ($outage instanceof outage) { $this->_form->setDefaults([ 'id' => $outage->id, - 'autostart' => $outage->autostart, + // 'autostart' => $outage->autostart, 'starttime' => $outage->starttime, 'outageduration' => $outage->get_duration_planned(), 'warningduration' => $outage->get_warning_duration(), diff --git a/db/upgrade.php b/db/upgrade.php index 8d28ef6..6df6a9e 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -75,5 +75,14 @@ function xmldb_auth_outage_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2026011301, 'auth', 'outage'); } + if ($oldversion < 2024081902) { + + // Removing the default_autostart config as it is no longer used. + unset_config('default_autostart', 'auth_outage'); + + // Outage savepoint reached. + upgrade_plugin_savepoint(true, 2024081902, 'auth', 'outage'); + } + return true; } diff --git a/lang/en/auth_outage.php b/lang/en/auth_outage.php index 6972aab..3e5bf91 100644 --- a/lang/en/auth_outage.php +++ b/lang/en/auth_outage.php @@ -32,9 +32,6 @@ $string['allowedipsnoconfig'] = 'Your config.php does not have the extra setup t $string['auth_outagedescription'] = 'Auxiliary plugin that warns users about a future outage and prevents them from logging in once the outage starts.'; $string['autostart'] = 'Auto start maintenance mode.'; $string['autostart_help'] = 'If selected, when the outage starts it will automatically turn on Moodle maintenance mode.'; -$string['autostartforcedoff'] = 'Force off'; -$string['autostartoff'] = 'Default off'; -$string['autostarton'] = 'Default on'; $string['builtinallowediplist'] = 'Builtin Allowed IP List'; $string['builtinallowediplist_desc'] = 'A second allowed IP list which makes it easier to have some IPs forced in config.php and others editable in the UI'; $string['clicreateexamples'] = "Create an outage starting in 10 seconds\n\n> php create.php -s=10"; diff --git a/settings.php b/settings.php index dfd5221..e239987 100644 --- a/settings.php +++ b/settings.php @@ -43,18 +43,6 @@ if ($hassiteconfig) { get_string('settingssectiondefaultsdescription', 'auth_outage') . $description )); - $settings->add(new admin_setting_configselect( - 'auth_outage/default_autostart', - get_string('defaultoutageautostart', 'auth_outage'), - get_string('defaultoutageautostartdescription', 'auth_outage'), - '0', - [ - '0' => get_string('autostartoff', 'auth_outage'), - '1' => get_string('autostarton', 'auth_outage'), - '2' => get_string('autostartforcedoff', 'auth_outage'), - ] - )); - $settings->add(new admin_setting_configduration( 'auth_outage/default_warning_duration', get_string('defaultwarningduration', 'auth_outage'),