From: stronk7 <stronk7>
Date: Thu, 6 May 2004 23:20:25 +0000 (+0000)
Subject: Now ORIGINAL_WWWROOT is saved in backup and restored too!!
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c9c89845822a315bb1d0c590baf9faaff91e4bd1;p=moodle.git

Now ORIGINAL_WWWROOT is saved in backup and restored too!!
---

diff --git a/backup/backuplib.php b/backup/backuplib.php
index 98a565e0f6..50b3ae9305 100644
--- a/backup/backuplib.php
+++ b/backup/backuplib.php
@@ -457,6 +457,8 @@
         fwrite ($bf,full_tag("BACKUP_RELEASE",2,false,$preferences->backup_release));
         //The date
         fwrite ($bf,full_tag("DATE",2,false,$preferences->backup_unique_code));
+        //The original site wwwroot
+        fwrite ($bf,full_tag("ORIGINAL_WWWROOT",2,false,$CFG->wwwroot));
         //Te includes tag
         fwrite ($bf,start_tag("DETAILS",2,true));
         //Now, go to mod element of preferences to print its status
diff --git a/backup/restore_execute.html b/backup/restore_execute.html
index eb25617aaf..866eed4665 100644
--- a/backup/restore_execute.html
+++ b/backup/restore_execute.html
@@ -10,6 +10,10 @@
         $restore = $SESSION->restore;
     }
 
+    //Add info->original_wwwroot to $restore to be able to use it in all the restore process
+    //(mainly when decoding internal links)
+    $restore->original_wwwroot = $info->original_wwwroot;
+
     //Check login
     require_login();
 
diff --git a/backup/restorelib.php b/backup/restorelib.php
index e6ba723c0e..199ce2d1a7 100644
--- a/backup/restorelib.php
+++ b/backup/restorelib.php
@@ -1946,6 +1946,9 @@
                         case "DATE":
                             $this->info->backup_date = $this->getContents();
                             break;
+                        case "ORIGINAL_WWWROOT":
+                            $this->info->original_wwwroot = $this->getContents();
+                            break;
                     }
                 }
                 if ($this->tree[3] == "DETAILS") {