Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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)
  • Loading branch information...
commit ad6c3675835843d5bd33498b550dcd4099a69b6e 1 parent 7ffa425
stronk7 authored
View
10 backup/backuplib.php
@@ -1134,8 +1134,9 @@ function backup_module($bf,$preferences,$module) {
//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) {
@@ -1152,9 +1153,10 @@ function backup_encode_absolute_links($content) {
}
//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
13 backup/restorelib.php
@@ -1257,7 +1257,8 @@ function restore_create_events($restore,$xml_file) {
//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
@@ -1268,8 +1269,16 @@ function restore_decode_absolute_links($content) {
//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
4 backup/version.php
@@ -5,6 +5,6 @@
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
-$backup_version = 2004052400; // The current version is a date (YYYYMMDDXX)
+$backup_version = 2004052403; // The current version is a date (YYYYMMDDXX)
-$backup_release = "1.3.2"; // User-friendly version number
+$backup_release = "1.3.3"; // User-friendly version number
Please sign in to comment.
Something went wrong with that request. Please try again.