MDL-84351 tool_mfa: Fix guidance page file access

File uploaded to the guidance page were not accessible due to
null values being provided to $course and $cm params for the
tool_mfa_pluginfile.
This commit is contained in:
David Woloszyn
2025-04-09 16:50:17 +07:00
committed by Huong Nguyen
parent 4680d53f4a
commit be007459d3
+3 -3
View File
@@ -126,8 +126,8 @@ function tool_mfa_bulk_user_actions(): array {
/**
* Serves any files for the guidance page.
*
* @param stdClass $course
* @param stdClass $cm
* @param stdClass|null $course
* @param stdClass|null $cm
* @param context $context
* @param string $filearea
* @param array $args
@@ -135,7 +135,7 @@ function tool_mfa_bulk_user_actions(): array {
* @param array $options
* @return bool
*/
function tool_mfa_pluginfile(stdClass $course, stdClass $cm, context $context, string $filearea,
function tool_mfa_pluginfile(stdClass|null $course, stdClass|null $cm, context $context, string $filearea,
array $args, bool $forcedownload, array $options = []): bool {
// Hardcode to only send guidance files from the top level.
$fs = get_file_storage();