Merge branch '83136-fix-unknowncategory-message-main' of https://github.com/DSI-Universite-Rennes2/moodle

This commit is contained in:
Sara Arjona
2025-03-13 12:38:35 +01:00
2 changed files with 4 additions and 5 deletions
+2 -2
View File
@@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
use core\exception\moodle_exception;
/**
* Class to store, cache, render and manage course category
@@ -272,7 +272,7 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
if (!$coursecat) {
// Course category not found.
if ($strictness == MUST_EXIST) {
throw new moodle_exception('unknowncategory');
throw new moodle_exception('unknowncategory', a: $id);
}
$coursecat = null;
} else if (!$alwaysreturnhidden && !$coursecat->is_uservisible($user)) {
+2 -3
View File
@@ -25,8 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
use core\exception\moodle_exception;
use core\navigation\views\primary;
use core\navigation\views\secondary;
use core\navigation\output\primary as primaryoutput;
@@ -2181,7 +2180,7 @@ class moodle_page {
global $DB;
$category = $DB->get_record('course_categories', array('id' => $categoryid));
if (!$category) {
throw new moodle_exception('unknowncategory');
throw new moodle_exception('unknowncategory', a: $categoryid);
}
$this->_categories[$category->id] = $category;
$parentcategoryids = explode('/', trim($category->path, '/'));