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
This commit is contained in:
stronk7 2005-07-04 17:48:59 +00:00
parent c781942f1a
commit 92f9357579

View File

@ -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 "<ul>";
@ -75,15 +72,31 @@
//Check if the xxxx_decode_content_links_caller exists
$function_name = $name."_decode_content_links_caller";
if (function_exists($function_name)) {
echo "<li>".get_string ("to")." ".get_string("modulenameplural",$name);
echo "<li>".get_string ("from")." ".get_string("modulenameplural",$name);
$status = $function_name($restore);
echo '</li>';
}
}
}
echo "</ul>";
// 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.