From 3b87330bb1f0003248f6a414a38f59800d728f33 Mon Sep 17 00:00:00 2001 From: Sarah Cotton Date: Wed, 14 Dec 2022 14:51:49 +0000 Subject: [PATCH 1/3] Fix for Moodle 4.1 The settings page is ignored on install so when the admin settings page is next loaded, the default settings cannot be found and undefined offset warnings are thrown. --- settings.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/settings.php b/settings.php index cfb919e..068986c 100644 --- a/settings.php +++ b/settings.php @@ -26,25 +26,30 @@ * @var admin_settingpage $settings * @var bootstrap_renderer $OUTPUT * @var admin_root $ADMIN + * @var moodle_page $PAGE */ use auth_outage\local\outagelib; defined('MOODLE_INTERNAL') || die; -if ($hassiteconfig && is_enabled_auth('outage')) { +if ($hassiteconfig) { $defaults = outagelib::get_config_defaults(); $settings->visiblename = get_string('menusettings', 'auth_outage'); + $description = outagelib::generate_plugin_configuration_warning(); $settings->add(new admin_setting_heading( 'defaults', get_string('settingssectiondefaults', 'auth_outage'), - get_string('settingssectiondefaultsdescription', 'auth_outage'))); + get_string('settingssectiondefaultsdescription', 'auth_outage') . $description + )); + $settings->add(new admin_setting_configcheckbox( 'auth_outage/default_autostart', get_string('defaultoutageautostart', 'auth_outage'), get_string('defaultoutageautostartdescription', 'auth_outage'), $defaults['default_autostart'] )); + $settings->add(new admin_setting_configduration( 'auth_outage/default_warning_duration', get_string('defaultwarningduration', 'auth_outage'), @@ -96,21 +101,22 @@ if ($hassiteconfig && is_enabled_auth('outage')) { // Create 'Allowed IPs' settings. $allowedips = outagelib::get_config()->allowedips; - $description = outagelib::generate_plugin_configuration_warning(); if (trim($allowedips) == '') { $message = 'allowedipsempty'; $type = 'notifymessage'; - } else if (remoteip_in_list($allowedips)) { - $message = 'allowedipshasmyip'; - $type = 'notifysuccess'; } else { - $message = 'allowedipshasntmyip'; - $type = 'notifyerror'; + if (remoteip_in_list($allowedips)) { + $message = 'allowedipshasmyip'; + $type = 'notifysuccess'; + } else { + $message = 'allowedipshasntmyip'; + $type = 'notifyerror'; + } }; - $description .= $OUTPUT->notification(get_string($message, 'auth_outage', ['ip' => getremoteaddr()]), $type); + $description = $OUTPUT->notification(get_string($message, 'auth_outage', ['ip' => getremoteaddr()]), $type); - $description .= '

'.get_string('ipblockersyntax', 'admin').'

'; - $description .= '

'.get_string('ips_combine', 'auth_outage').'

'; + $description .= '

' . get_string('ipblockersyntax', 'admin') . '

'; + $description .= '

' . get_string('ips_combine', 'auth_outage') . '

'; $iplist = new admin_setting_configiplist( 'auth_outage/allowedips', @@ -150,7 +156,7 @@ if ($hassiteconfig && is_enabled_auth('outage')) { new admin_externalpage( 'auth_outage_manage', get_string('menumanage', 'auth_outage'), - new moodle_url($CFG->wwwroot.'/auth/outage/manage.php') + new moodle_url($CFG->wwwroot . '/auth/outage/manage.php') ) ); } From 85bcca8d3886508ff4da6735418913e4be21a3a9 Mon Sep 17 00:00:00 2001 From: Sarah Cotton Date: Fri, 27 Jan 2023 15:32:46 +0000 Subject: [PATCH 2/3] Update ci workflow and badge --- .github/workflows/ci.yml | 5 +++-- README.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a663f92..ef23d2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,10 @@ +# .github/workflows/ci.yml name: ci on: [push, pull_request] jobs: - test: - uses: catalyst/catalyst-moodle-workflows/.github/workflows/group-39-plus-ci.yml@main + ci: + uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main with: disable_behat: true diff --git a/README.md b/README.md index 3ac8e97..b50ee46 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://github.com/catalyst/moodle-auth_outage/workflows/Run%20all%20tests%20for%20Moodle%2039+/badge.svg)](https://github.com/catalyst/moodle-auth_outage/actions) +![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/catalyst/moodle-auth_outage/ci.yml?branch=MOODLE_39_STABLE) # Moodle Outage manager plugin * [Version Support](#version-support) From a8aa5c49c5f8e0b13735a78ca0803104cb9e67a0 Mon Sep 17 00:00:00 2001 From: Sarah Cotton Date: Fri, 27 Jan 2023 15:34:38 +0000 Subject: [PATCH 3/3] Version bump --- version.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.php b/version.php index dd71866..801be6d 100644 --- a/version.php +++ b/version.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = "auth_outage"; -$plugin->version = 2022121900; // The current plugin version (Date: YYYYMMDDXX). -$plugin->release = 2022121900; // Human-readable release information. +$plugin->version = 2023012700; // The current plugin version (Date: YYYYMMDDXX). +$plugin->release = 2023012700; // 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, 311]; // A range of branch numbers of supported moodle versions. +$plugin->supported = [39, 401]; // A range of branch numbers of supported moodle versions.