Codechecker fixes and removed other comments.

This commit is contained in:
abhinavgandham
2026-01-20 15:18:21 +10:00
committed by Brendan Heywood
parent 0bff6f5145
commit ffda33329c
5 changed files with 5 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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