Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Now only restored wikis (posts and resources) are re-encoded when

restoring to a existing course. Bug 1571.
(http://moodle.org/bugs/bug.php?op=show&bugid=1571)
  • Loading branch information...
commit 5180efaa902d4c757cd7a97ef8d89c279a5ff1d7 1 parent 1a55aa4
stronk7 authored

Showing 2 changed files with 15 additions and 7 deletions. Show diff stats Hide diff stats

  1. +14 6 backup/restorelib.php
  2. +1 1  backup/version.php
20 backup/restorelib.php
@@ -131,13 +131,17 @@ function restore_decode_wiki_texts($restore) {
131 131 //Check we are restoring forums
132 132 if ($restore->mods['forum']->restore == 1) {
133 133 echo "<li>".get_string("from")." ".get_string("modulenameplural","forum");
134   - //Get all course posts
  134 + //Get all course posts being restored
135 135 if ($posts = get_records_sql ("SELECT p.id, p.message
136 136 FROM {$CFG->prefix}forum_posts p,
137   - {$CFG->prefix}forum_discussions d
  137 + {$CFG->prefix}forum_discussions d,
  138 + {$CFG->prefix}backup_ids b
138 139 WHERE d.course = $restore->course_id AND
139 140 p.discussion = d.id AND
140   - p.format = $formatwiki")) {
  141 + p.format = $formatwiki AND
  142 + b.backup_code = $restore->backup_unique_code AND
  143 + b.table_name = 'forum_posts' AND
  144 + b.new_id = p.id")) {
141 145 //Iterate over each post->message
142 146 $i = 0; //Counter to send some output to the browser to avoid timeouts
143 147 foreach ($posts as $post) {
@@ -172,11 +176,15 @@ function restore_decode_wiki_texts($restore) {
172 176 //Check we are restoring resources
173 177 if ($restore->mods['resource']->restore == 1) {
174 178 echo "<li>".get_string("from")." ".get_string("modulenameplural","resource");
175   - //Get all course resources of type=8 WIKITEXT
  179 + //Get all course resources of type=8 WIKITEXT being restored
176 180 if ($resources = get_records_sql ("SELECT r.id, r.alltext
177   - FROM {$CFG->prefix}resource r
  181 + FROM {$CFG->prefix}resource r,
  182 + {$CFG->prefix}backup_ids b
178 183 WHERE r.course = $restore->course_id AND
179   - r.type = $typewiki")) {
  184 + r.type = $typewiki AND
  185 + b.backup_code = $restore->backup_unique_code AND
  186 + b.table_name = 'resource' AND
  187 + b.new_id = r.id")) {
180 188 //Iterate over each resource->alltext
181 189 $i = 0; //Counter to send some output to the browser to avoid timeouts
182 190 foreach ($resources as $resource) {
2  backup/version.php
@@ -7,4 +7,4 @@
7 7
8 8 $backup_version = 2004052400; // The current version is a date (YYYYMMDDXX)
9 9
10   -$backup_release = "1.3"; // User-friendly version number
  10 +$backup_release = "1.3.2"; // User-friendly version number

0 comments on commit 5180efa

Please sign in to comment.
Something went wrong with that request. Please try again.