diff --git a/mod/forum/backup/moodle2/restore_forum_stepslib.php b/mod/forum/backup/moodle2/restore_forum_stepslib.php index 4eb0bc31813..62e48fae928 100644 --- a/mod/forum/backup/moodle2/restore_forum_stepslib.php +++ b/mod/forum/backup/moodle2/restore_forum_stepslib.php @@ -206,11 +206,17 @@ class restore_forum_activity_structure_step extends restore_activity_structure_s } protected function after_execute() { - global $DB; - // Add forum related files, no need to match by itemname (just internally handled context) $this->add_related_files('mod_forum', 'intro', null); + // Add post related files, matching by itemname = 'forum_post' + $this->add_related_files('mod_forum', 'post', 'forum_post'); + $this->add_related_files('mod_forum', 'attachment', 'forum_post'); + } + + protected function after_restore() { + global $DB; + // If the forum is of type 'single' and no discussion has been ignited // (non-userinfo backup/restore) create the discussion here, using forum // information as base for the initial post. @@ -240,9 +246,5 @@ class restore_forum_activity_structure_step extends restore_activity_structure_s $fs->create_file_from_storedfile($newfilerecord, $file); } } - - // Add post related files, matching by itemname = 'forum_post' - $this->add_related_files('mod_forum', 'post', 'forum_post'); - $this->add_related_files('mod_forum', 'attachment', 'forum_post'); } }