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
This commit is contained in:
stronk7 2004-07-15 23:04:22 +00:00
parent 0308deea55
commit baadcd6560
3 changed files with 18 additions and 7 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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