From 78f239c89083df42aa5fffb1b6d5144f39f399f9 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Fri, 3 Nov 2023 12:21:03 +0100 Subject: [PATCH] MDL-79992 backup: Display course backups from activity restore The Course backup area was not displaying the course backups when accessing to the Restore page for an activity because the context was not updated properly for this area. --- backup/restorefile.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backup/restorefile.php b/backup/restorefile.php index 541c7167cd9..1140dbe7746 100644 --- a/backup/restorefile.php +++ b/backup/restorefile.php @@ -160,12 +160,16 @@ if ($context->contextlevel == CONTEXT_MODULE) { $renderer = $PAGE->get_renderer('core', 'backup'); echo $renderer->backup_files_viewer($treeview_options); echo $OUTPUT->container_end(); + // Update the course context with the proper value, because $context contains the module context. + $coursecontext = \context_course::instance($course->id); +} else { + $coursecontext = $context; } echo $OUTPUT->heading_with_help(get_string('choosefilefromcoursebackup', 'backup'), 'choosefilefromcoursebackup', 'backup'); echo $OUTPUT->container_start(); $treeview_options = array(); -$treeview_options['filecontext'] = $context; +$treeview_options['filecontext'] = $coursecontext; $treeview_options['currentcontext'] = $context; $treeview_options['component'] = 'backup'; $treeview_options['context'] = $context;