From 0f80f793df092dedfe283fd526e0fc26244e81c1 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 28 Feb 2018 01:31:20 +1100 Subject: [PATCH] MDL-61526 Questions: Fix creation of multiple TOP question categories Backup files that are made from Moodle 3.5 already contain TOP categories. There is no need to create an additional TOP category for them. --- backup/moodle2/restore_stepslib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index 6e050abd0e9..b96a02e32bc 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -4409,8 +4409,7 @@ class restore_create_categories_and_questions extends restore_structure_step { if ($backuprelease < 3.5 || $backupbuild < 20180205) { $before35 = true; } - if (empty($mapping->info->parent) && - ($before35 || $mapping->info->contextlevel == CONTEXT_MODULE)) { + if (empty($mapping->info->parent) && $before35) { $top = question_get_top_category($data->contextid, true); $data->parent = $top->id; }