From 92f2b31f746baedc952de47d3f3636ef44b39bf4 Mon Sep 17 00:00:00 2001 From: Mark Nielsen Date: Wed, 30 Mar 2016 13:54:00 -0700 Subject: [PATCH] MDL-53660 mod_forum: Fix link decoding in single discussions This only happens when user data is not included. --- .../backup/moodle2/restore_forum_stepslib.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mod/forum/backup/moodle2/restore_forum_stepslib.php b/mod/forum/backup/moodle2/restore_forum_stepslib.php index f76a7c4adcd..b810bb33cec 100644 --- a/mod/forum/backup/moodle2/restore_forum_stepslib.php +++ b/mod/forum/backup/moodle2/restore_forum_stepslib.php @@ -203,11 +203,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. @@ -237,9 +243,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'); } }