From 0bff6f514572604cd0658f1cf2d6f6dac3d89c6a 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 | 6 +++--- settings.php | 12 ------------ version.php | 4 ++-- 5 files changed, 16 insertions(+), 24 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 e70aaa3..6cb392f 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -76,5 +76,14 @@ function xmldb_auth_outage_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2024081901, '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 5d72a9f..8f00c00 100644 --- a/lang/en/auth_outage.php +++ b/lang/en/auth_outage.php @@ -32,9 +32,9 @@ $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['autostartoff'] = 'Default off'; -$string['autostarton'] = 'Default on'; -$string['autostartforcedoff'] = 'Force off'; +// $string['autostartoff'] = 'Default off'; +// $string['autostarton'] = 'Default on'; +// $string['autostartforcedoff'] = 'Force off'; $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'), diff --git a/version.php b/version.php index 7b95439..3025f3e 100644 --- a/version.php +++ b/version.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = "auth_outage"; -$plugin->version = 2024081901; // The current plugin version (Date: YYYYMMDDXX). -$plugin->release = 2024081901; // Human-readable release information. +$plugin->version = 2024081902; // The current plugin version (Date: YYYYMMDDXX). +$plugin->release = 2024081902; // Human-readable release information. $plugin->requires = 2017111309; // 2017111309 = T13, but this really requires 3.9 and higher. $plugin->maturity = MATURITY_STABLE; // Suitable for PRODUCTION environments! $plugin->supported = [39, 405]; // A range of branch numbers of supported moodle versions.