From aee6e963f2414697cf20677714a062a8109d33e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 10 Sep 2025 10:36:40 +0200 Subject: [PATCH] MDL-86523 backup: update context only if also updating category. --- backup/moodle2/restore_stepslib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index c34d3490413..e7270333b9c 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -6449,15 +6449,15 @@ trait restore_question_set_reference_data_trait { ) { $newcategoryid = $this->get_mappingid('question_category', $oldcategoryid); $filtercondition['filter']['category']['values'][0] = $newcategoryid; - } - if ($context = $this->get_mappingid('context', $data->questionscontextid)) { - $data->questionscontextid = $context; - } else { - $this->log('question_set_reference with old id ' . $data->id . - ' referenced question context ' . $data->questionscontextid . - ' which was not included in the backup. Therefore, this has been ' . - ' restored with the old questionscontextid.', backup::LOG_WARNING); + if ($context = $this->get_mappingid('context', $data->questionscontextid)) { + $data->questionscontextid = $context; + } else { + $this->log('question_set_reference with old id ' . $data->id . + ' referenced question context ' . $data->questionscontextid . + ' which was not included in the backup. Therefore, this has been ' . + ' restored with the old questionscontextid.', backup::LOG_WARNING); + } } $filtercondition['cat'] = implode(',', [