From e9e9b197b36269e26dd8018723a9c66e73acacfd Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 28 Mar 2014 10:26:01 +0800 Subject: [PATCH] MDL-35305 wiki: backup and restore files Thanks to Tatsuya Shirai for the patch --- mod/wiki/backup/moodle2/backup_wiki_stepslib.php | 2 +- mod/wiki/backup/moodle2/restore_wiki_stepslib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/wiki/backup/moodle2/backup_wiki_stepslib.php b/mod/wiki/backup/moodle2/backup_wiki_stepslib.php index f0288b2cddf..91192905142 100644 --- a/mod/wiki/backup/moodle2/backup_wiki_stepslib.php +++ b/mod/wiki/backup/moodle2/backup_wiki_stepslib.php @@ -120,7 +120,7 @@ class backup_wiki_activity_structure_step extends backup_activity_structure_step // Define file annotations $wiki->annotate_files('mod_wiki', 'intro', null); // This file area hasn't itemid - $page->annotate_files('mod_wiki', 'attachments', 'id'); // This file area hasn't itemid + $subwiki->annotate_files('mod_wiki', 'attachments', 'id'); // This file area hasn't itemid // Return the root element (wiki), wrapped into standard activity structure return $this->prepare_activity_structure($wiki); diff --git a/mod/wiki/backup/moodle2/restore_wiki_stepslib.php b/mod/wiki/backup/moodle2/restore_wiki_stepslib.php index d57f32cfe19..bae98ddfcdb 100644 --- a/mod/wiki/backup/moodle2/restore_wiki_stepslib.php +++ b/mod/wiki/backup/moodle2/restore_wiki_stepslib.php @@ -91,7 +91,7 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st $newitemid = false; } - $this->set_mapping('wiki_subwiki', $oldid, $newitemid); + $this->set_mapping('wiki_subwiki', $oldid, $newitemid, true); } protected function process_wiki_page($data) { @@ -174,6 +174,6 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st protected function after_execute() { // Add wiki related files, no need to match by itemname (just internally handled context) $this->add_related_files('mod_wiki', 'intro', null); - $this->add_related_files('mod_wiki', 'attachments', 'wiki_page'); + $this->add_related_files('mod_wiki', 'attachments', 'wiki_subwiki'); } }