Issue #390: Reverted new 'Force off' option and dropdown conversion.

This commit is contained in:
abhinavgandham
2026-01-20 15:06:49 +10:00
committed by Brendan Heywood
parent bffd5f39f9
commit 0bff6f5145
5 changed files with 16 additions and 24 deletions

View File

@@ -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(),

View File

@@ -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;
}

View File

@@ -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";

View File

@@ -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'),

View File

@@ -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.