mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Converting wiki to markdown in old (<2005041100) courses.
First step. Launcher created.
This commit is contained in:
parent
a8093758b1
commit
805788218b
@ -13,6 +13,9 @@
|
||||
//Add info->original_wwwroot to $restore to be able to use it in all the restore process
|
||||
//(mainly when decoding internal links)
|
||||
$restore->original_wwwroot = $info->original_wwwroot;
|
||||
//Add info->backup_version to $restore to be able to detect versions in the restore process
|
||||
//(to decide when to convert wiki texts to markdown...)
|
||||
$restore->backup_version = $info->backup_backup_version;
|
||||
|
||||
//Check login
|
||||
require_login();
|
||||
@ -330,6 +333,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Now, with backup files prior to version 2005041100,
|
||||
//convert all the wiki texts in the course to markdown
|
||||
if ($status && $restore->backup_version < 2005041100) {
|
||||
echo "<li>".get_string("convertingwikitomarkdown");
|
||||
if (!$status = restore_convert_wiki2markdown($restore)) {
|
||||
notify("Could not convert wiki texts to markdown!");
|
||||
}
|
||||
}
|
||||
|
||||
//Now if all is OK, update:
|
||||
// - course modinfo field
|
||||
// - categories table
|
||||
|
@ -93,6 +93,30 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function converts all the wiki texts in the restored course
|
||||
//to the Markdown format. Used only for backup files prior 2005041100.
|
||||
//It calls every module xxxx_convert_wiki2markdown function
|
||||
function restore_convert_wiki2markdown($restore) {
|
||||
|
||||
$status = true;
|
||||
|
||||
echo "<ul>";
|
||||
foreach ($restore->mods as $name => $info) {
|
||||
//If the module is being restored
|
||||
if ($info->restore == 1) {
|
||||
//Check if the xxxx_convert_wiki2markdown exists
|
||||
$function_name = $name."_convert_wiki2markdown";
|
||||
if (function_exists($function_name)) {
|
||||
echo "<li>".get_string("modulenameplural",$name);
|
||||
$status = $function_name($restore);
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function search for some wiki texts in differenct parts of Moodle to
|
||||
//decode them to their new ids.
|
||||
function restore_decode_wiki_texts($restore) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user