From 9f60cb0ae5e3250ac21a53548742f4484de415a4 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 9 Jan 2025 15:34:03 +0000 Subject: [PATCH] MDL-84140 course: more resilient check for activity footer component. --- course/externallib.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/course/externallib.php b/course/externallib.php index c4825433f0e..177f779fd9e 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -4616,9 +4616,17 @@ class core_course_external extends external_api { $coursecontext = context_course::instance($courseid); self::validate_context($coursecontext); - $activeplugin = get_config('core', 'activitychooseractivefooter'); + // The active plugin must be set, and be present on the site. + $activeplugin = clean_param( + get_config('core', 'activitychooseractivefooter'), + PARAM_COMPONENT, + ); - if ($activeplugin !== COURSE_CHOOSER_FOOTER_NONE) { + if ( + $activeplugin !== COURSE_CHOOSER_FOOTER_NONE && + !empty($activeplugin) && + core_component::get_component_directory($activeplugin) !== null + ) { $footerdata = component_callback($activeplugin, 'custom_chooser_footer', [$courseid, $sectionid]); return [ 'footer' => true,