From f816040530932b6fd3be09075bf441b4f5ba8c5b Mon Sep 17 00:00:00 2001 From: Mike Churchward Date: Wed, 5 May 2021 11:20:54 -0400 Subject: [PATCH] MDL-71539 tool_brickfield: PHP8 optional param error fixed. --- admin/tool/brickfield/classes/accessibility.php | 10 ++++------ admin/tool/brickfield/index.php | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/admin/tool/brickfield/classes/accessibility.php b/admin/tool/brickfield/classes/accessibility.php index 2655106682b2a..658a376577cd8 100644 --- a/admin/tool/brickfield/classes/accessibility.php +++ b/admin/tool/brickfield/classes/accessibility.php @@ -17,7 +17,7 @@ namespace tool_brickfield; use context_system; -use core\log\sql_reader; +use moodle_exception; use moodle_url; use stdClass; use tool_brickfield\local\tool\filter; @@ -59,11 +59,11 @@ public static function is_accessibility_enabled(): bool { /** * Throw an error if the toolkit is not enabled. * @return bool - * @throws \moodle_exception + * @throws moodle_exception */ public static function require_accessibility_enabled(): bool { if (!static::is_accessibility_enabled()) { - print_error('accessibilitydisabled', manager::PLUGINNAME); + throw new moodle_exception('accessibilitydisabled', manager::PLUGINNAME); } return true; } @@ -217,10 +217,8 @@ public static function bulk_process_caches_cron() { * @param int $contentid The content area ID * @param int $processingtime * @param int $resultstime - * @throws \coding_exception - * @throws \dml_exception */ - public static function run_check(string $html = '', int $contentid, int &$processingtime, int &$resultstime) { + public static function run_check(string $html, int $contentid, int &$processingtime, int &$resultstime) { global $DB; // Change the limit if 10,000 is not appropriate. diff --git a/admin/tool/brickfield/index.php b/admin/tool/brickfield/index.php index 02d2842ff7f8d..6ce803e11b422 100644 --- a/admin/tool/brickfield/index.php +++ b/admin/tool/brickfield/index.php @@ -58,7 +58,7 @@ if ($courseid != 0) { // If accessing a course, check that the user has capability to use toolkit at course level. if (!$course = $DB->get_record('course', ['id' => $courseid], '*')) { - print_error('invalidcourseid', manager::PLUGINNAME); + throw new moodle_exception('invalidcourseid', manager::PLUGINNAME); } require_login($course); $context = context_course::instance($courseid); @@ -101,7 +101,7 @@ if (isset($tools[$tab])) { $tool = $tools[$tab]; } else { - print_error('invalidaccessibilitytool', manager::PLUGINNAME); + throw new moodle_exception('invalidaccessibilitytool', manager::PLUGINNAME); } $perpagedefault = $config->perpage;