From 8e0ccfe8dd9b0f3898e3c98270eb2befdc3831c5 Mon Sep 17 00:00:00 2001 From: Benjamin Walker Date: Thu, 14 Mar 2024 11:38:29 +1000 Subject: [PATCH 1/2] CI cleanup --- classes/helper.php | 6 +++++- classes/privacy/provider.php | 2 +- classes/table/csp_report.php | 8 +++++++- db/access.php | 2 ++ db/upgrade.php | 6 ++++++ templates/notification.mustache | 12 ++++++++++++ 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/classes/helper.php b/classes/helper.php index 359549f..e042c72 100644 --- a/classes/helper.php +++ b/classes/helper.php @@ -46,7 +46,7 @@ public static function enable_csp_header() { global $USER, $COURSE; $settings = get_config('local_csp'); - if (self::$bootstrapped or empty($settings->csp_header_enable)) { + if (self::$bootstrapped || empty($settings->csp_header_enable)) { return; } self::$bootstrapped = true; @@ -66,6 +66,10 @@ public static function enable_csp_header() { } } + /** + * Enables feature policy + * @return void + */ public static function enable_feature_policy() { $settings = get_config('local_csp'); if (empty($settings->feature_policy_enable)) { diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index c972009..8018686 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -26,7 +26,7 @@ /** * Class provider - * @package local_csp\privacy + * @package local_csp */ class provider implements \core_privacy\local\metadata\null_provider { diff --git a/classes/table/csp_report.php b/classes/table/csp_report.php index 23d8ff5..5f5c2f2 100644 --- a/classes/table/csp_report.php +++ b/classes/table/csp_report.php @@ -35,7 +35,7 @@ * - Convert unix timestamp columns to human time. * - Adds a button to delete a record. * - * @package local_csp\table + * @package local_csp * @copyright Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -238,6 +238,12 @@ protected function col_highestviolaters($record) { return $return; } + /** + * Gets the 3 highest violater courses for each blockedURI + * + * @param \stdClass $record fieldset object of db table + * @return string details of the highest violating courses + */ protected function col_courses($record) { global $DB; diff --git a/db/access.php b/db/access.php index 9bcdecd..6e814d4 100644 --- a/db/access.php +++ b/db/access.php @@ -19,6 +19,8 @@ * Plugin capabilities * * @package local_csp + * @copyright 2022 Catalyst IT + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/db/upgrade.php b/db/upgrade.php index 3514d6c..3e50c4f 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -23,6 +23,12 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +/** + * Function to upgrade local_csp. + * + * @param int $oldversion the version we are upgrading from + * @return bool result + */ function xmldb_local_csp_upgrade($oldversion) { global $DB; $dbman = $DB->get_manager(); diff --git a/templates/notification.mustache b/templates/notification.mustache index 77aedc4..42f53c9 100644 --- a/templates/notification.mustache +++ b/templates/notification.mustache @@ -14,7 +14,19 @@ You should have received a copy of the GNU General Public License along with Moodle. If not, see . }} +{{! + @template local_csp/notification + + Inputs for optional notification. + Example context (json): + { + "header": "Header", + "start": "Start", + "sourcesText": "Sources", + "events": [] + } +}}

{{header}}

{{start}}

{{sourcesText}}

From 59534e707710300ff9c90461d0759df20ff0ca85 Mon Sep 17 00:00:00 2001 From: Benjamin Walker Date: Thu, 14 Mar 2024 12:36:15 +1000 Subject: [PATCH 2/2] Update supported versions --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2327d6c..306454b 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,8 @@ Branches | Moodle verion | Branch | PHP | | ----------------- | --------------------- | -------- | -| Moodle 3.3 to 3.7 | master | 7.2 | +| Moodle 4.1+ | MOODLE_401_STABLE | 7.4 | +| Moodle 3.3 to 4.0 | master | 7.2 | | Moodle 2.7 | MOODLE_27_STABLE | 5.5 | Performance impact