--- backup/backuplib.php 2008-12-16 14:56:00.000000000 -0800 +++ backup/backuplib.php 2009-01-09 11:55:00.000000000 -0800 @@ -2354,6 +2354,25 @@ } } + // For the current course format call its encode_content_links method (if it exists) + static $format_function_name; + if (!isset($format_function_name)) { + $format_function_name = false; + if ($format = get_field('course', 'format', 'id', $mypreferences->backup_course)) { + if (file_exists("$CFG->dirroot/course/format/$format/backuplib.php")) { + include_once("$CFG->dirroot/course/format/$format/backuplib.php"); + $function_name = $format.'_encode_format_content_links'; + if (function_exists($function_name)) { + $format_function_name = $function_name; + } + } + } + } + // If the above worked - then we have a function to call + if ($format_function_name) { + $result = $format_function_name($result, $mypreferences); + } + // For each block, call its encode_content_links method. // This encodes forexample links to blocks/something/viewphp?id=666 // that are stored in other activities. --- backup/restorelib.php 2009-01-07 11:29:15.000000000 -0800 +++ backup/restorelib.php 2009-01-09 12:01:10.000000000 -0800 @@ -148,6 +148,23 @@ } } + // For the course format call its decode_content_links method (if it exists) + $format = get_field('course', 'format', 'id', $restore->course_id); + if (file_exists("$CFG->dirroot/course/format/$format/restorelib.php")) { + include_once("$CFG->dirroot/course/format/$format/restorelib.php"); + $function_name = $format.'_decode_format_content_links_caller'; + + if (function_exists($function_name)) { + if (!defined('RESTORE_SILENTLY')) { + echo "
  • ".get_string ("from")." ".get_string("format").' '.$format; + } + $status = $function_name($restore); + if (!defined('RESTORE_SILENTLY')) { + echo '
  • '; + } + } + } + // Process all html text also in blocks too if (!defined('RESTORE_SILENTLY')) { echo '
  • '.get_string ('from').' '.get_string('blocks'); @@ -186,6 +203,7 @@ //its task is to ask all modules (maybe other linkable objects) to restore //links to them. function restore_decode_content_links_worker($content,$restore) { + global $CFG; foreach($restore->mods as $name => $info) { $function_name = $name."_decode_content_links"; if (function_exists($function_name)) { @@ -193,6 +211,25 @@ } } + // For the current format, call decode_format_content_links if it exists + static $format_function_name; + if (!isset($format_function_name)) { + $format_function_name = false; + if ($format = get_field('course', 'format', 'id', $restore->course_id)) { + if (file_exists("$CFG->dirroot/course/format/$format/restorelib.php")) { + include_once("$CFG->dirroot/course/format/$format/restorelib.php"); + $function_name = $format.'_decode_format_content_links'; + if (function_exists($function_name)) { + $format_function_name = $function_name; + } + } + } + } + // If the above worked - then we have a function to call + if ($format_function_name) { + $content = $format_function_name($content, $restore); + } + // For each block, call its encode_content_links method static $blockobjects = null; if (!isset($blockobjects)) {