]> git.mjollnir.org Git - moodle.git/commitdiff
Ooops!! I thought I had sent this to CVS some days ago.
authorstronk7 <stronk7>
Thu, 15 Jul 2004 23:04:22 +0000 (23:04 +0000)
committerstronk7 <stronk7>
Thu, 15 Jul 2004 23:04:22 +0000 (23:04 +0000)
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

backup/backuplib.php
backup/restorelib.php
backup/version.php

index d5ce957a870783f79c1ce23d3961e58ebfe39d96..d233658334d0b83dba8287348485b70984855570 100644 (file)
 
     //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) {
 
         }
 
         //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);
 
index 78ad3266cb6627194c231d7ad089ba38ed9da17f..4821be728a22130c93e47303e459b7a3574d5703 100644 (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 
 
         //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);
 
index aa10c813e38beec251f549d2b8246129eeca9ea6..a773093446f50232e095cd6c1832be3c2c1f27ea 100644 (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