From 92f93575794013f0645b79e82b7a9f1da515003d Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 4 Jul 2005 17:48:59 +0000 Subject: [PATCH] Improved automatic relinking in backup and restore. Credits go to skodak. Complete refactoring of the system that was really awful (my fault!). Now everything is in its place and working like a charm, making things really easier to be implemented and amplied. Bug 3678 (http://moodle.org/bugs/bug.php?op=show&bugid=3678) (http://moodle.org/mod/forum/discuss.php?d=26530) Merged from MOODLE_15_STABLE --- backup/restorelib.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/backup/restorelib.php b/backup/restorelib.php index a5487a521a4..2717070ba10 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -63,9 +63,6 @@ //from backup format to destination site/course in order to mantain inter-activities //working in the backup/restore process function restore_decode_content_links($restore) { - - global $CFG; - $status = true; echo ""; + + // TODO: process all html text also in blocks too + return $status; } + + //This function is called from all xxxx_decode_content_links_caller(), + //its task is to ask all modules (maybe other linkable objects) to restore + //links to them. + function restore_decode_content_links_worker($content,$restore) { + foreach($restore->mods as $name => $info) { + $function_name = $name."_decode_content_links"; + if (function_exists($function_name)) { + $content = $function_name($content,$restore); + } + } + return $content; + } //This function converts all the wiki texts in the restored course //to the Markdown format. Used only for backup files prior 2005041100.