From: stronk7 Date: Thu, 15 Jul 2004 23:04:22 +0000 (+0000) Subject: Ooops!! I thought I had sent this to CVS some days ago. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=baadcd6560d6a2395e7530d2265d228a5a4eeb96;p=moodle.git Ooops!! I thought I had sent this to CVS some days ago. Now both type of links (slasharguments on and off) are detected in the backup process. And the restore process take care of the slasharguments seting in destination and translate all the links to the correct format. I think it's really a nice addition, ;-) Ready to 1.3.3 bump!!! Bug 1634 (http://moodle.org/bugs/bug.php?op=show&bugid=1634) Merged from MOODLE_13_STABLE --- diff --git a/backup/backuplib.php b/backup/backuplib.php index d5ce957a87..d233658334 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1138,8 +1138,9 @@ //This function encode things to make backup multi-site fully functional //It does this conversions: - // - $CFG->wwwroot/file.php/courseid ----------------------> $@FILEPHP@$ - // - Links to forums everywhere (DB) are encoded. + // - $CFG->wwwroot/file.php/courseid ------------------> $@FILEPHP@$ (slasharguments links) + // - $CFG->wwwroot/file.php?file=/courseid ------------> $@FILEPHP@$ (non-slasharguments links) + // - Every module xxxx_encode_content_links() is executed too // function backup_encode_absolute_links($content) { @@ -1156,9 +1157,10 @@ } //First, we check for every call to file.php inside the course - $search = array($CFG->wwwroot."/file.php/".$mypreferences->backup_course); + $search = array($CFG->wwwroot.'/file.php/'.$mypreferences->backup_course, + $CFG->wwwroot.'/file.php?file=/'.$mypreferences->backup_course); - $replace = array("$@FILEPHP@$"); + $replace = array('$@FILEPHP@$','$@FILEPHP@$'); $result = str_replace($search,$replace,$content); diff --git a/backup/restorelib.php b/backup/restorelib.php index 78ad3266cb..4821be728a 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -1259,7 +1259,8 @@ //This function decode things to make restore multi-site fully functional //It does this conversions: - // - $@FILEPHP@$ -------------------------------> $CFG->wwwroot/file.php/courseid + // - $@FILEPHP@$ ---|------------> $CFG->wwwroot/file.php/courseid (slasharguments on) + // |------------> $CFG->wwwroot/file.php?file=/courseid (slasharguments off) // //Note: Inter-activities linking is being implemented as a final //step in the restore execution, because we need to have it @@ -1270,8 +1271,16 @@ //Now decode wwwroot and file.php calls $search = array ("$@FILEPHP@$"); + + //Check for the status of the slasharguments config variable + $slash = $CFG->slasharguments; - $replace = array ($CFG->wwwroot."/file.php/".$restore->course_id); + //Build the replace string as needed + if ($slash == 1) { + $replace = array ($CFG->wwwroot."/file.php/".$restore->course_id); + } else { + $replace = array ($CFG->wwwroot."/file.php?file=/".$restore->course_id); + } $result = str_replace($search,$replace,$content); diff --git a/backup/version.php b/backup/version.php index aa10c813e3..a773093446 100644 --- a/backup/version.php +++ b/backup/version.php @@ -5,6 +5,6 @@ // database (backup_version) to determine whether upgrades should // be performed (see db/backup_*.php) -$backup_version = 2004070800; // The current version is a date (YYYYMMDDXX) +$backup_version = 2004071600; // The current version is a date (YYYYMMDDXX) $backup_release = "1.4 development"; // User-friendly version number