diff --git a/classes/form/outage/edit.php b/classes/form/outage/edit.php index 8fe1b1d..18622c1 100644 --- a/classes/form/outage/edit.php +++ b/classes/form/outage/edit.php @@ -136,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, @@ -161,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/classes/local/outagelib.php b/classes/local/outagelib.php index 93722c2..e782535 100644 --- a/classes/local/outagelib.php +++ b/classes/local/outagelib.php @@ -371,7 +371,8 @@ EOT; '{{YOURIP}}', '{{COOKIESECURE}}', '{{COOKIEHTTPONLY}}', '{{METADATA}}']; // Note that var_export is required because (string) false == '', not 'false'. $replace = [$starttime, $stoptime, var_export(!empty($allowedips), true), $allowedips, var_export(!empty($accesskey), true), - $accesskey, getremoteaddr('n/a'), var_export($cookiesecure, true), var_export($cookiehttponly, true), var_export($metadata, true)]; + $accesskey, getremoteaddr('n/a'), var_export($cookiesecure, true), + var_export($cookiehttponly, true), var_export($metadata, true)]; return str_replace($search, $replace, $code); } diff --git a/db/upgrade.php b/db/upgrade.php index 6cb392f..5e836db 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -62,7 +62,6 @@ function xmldb_auth_outage_upgrade($oldversion) { } if ($oldversion < 2024081901) { - // Define field metadata to be added to auth_outage. $table = new xmldb_table('auth_outage'); $field = new xmldb_field('metadata', XMLDB_TYPE_TEXT, null, null, null, null, null, 'accesskey'); @@ -77,7 +76,6 @@ function xmldb_auth_outage_upgrade($oldversion) { } if ($oldversion < 2024081902) { - // Removing the default_autostart config as it is no longer used. unset_config('default_autostart', 'auth_outage'); diff --git a/edit.php b/edit.php index d3f34a3..016d6bf 100644 --- a/edit.php +++ b/edit.php @@ -28,6 +28,7 @@ use auth_outage\form\outage\edit; use auth_outage\local\outage; use auth_outage\local\outagelib; + require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->libdir . '/formslib.php'); diff --git a/lang/en/auth_outage.php b/lang/en/auth_outage.php index 8f00c00..2948336 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['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";