From 4e96885c8a121ecfb84414d980e74171a05e0580 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 af884871d9834..cb558de044353 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -4596,9 +4596,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,