From 98e27c98c232884112a47799f299dc56eb2b68c1 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 1e040731f6e86..51679fcfee88c 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -4652,9 +4652,17 @@ public static function get_activity_chooser_footer(int $courseid, int $sectionid $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,