]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18469 restore missing session info - add a quick re-test of xml file
authorstronk7 <stronk7>
Mon, 5 Oct 2009 10:31:46 +0000 (10:31 +0000)
committerstronk7 <stronk7>
Mon, 5 Oct 2009 10:31:46 +0000 (10:31 +0000)
before any further processing by restore_execute(). More coming. Merged
from 19_STABLE

backup/restorelib.php

index 9e1c6710655921e9dcbf03aad439bf29d2b3c69e..47e0f9654dd0a3530cff598ae53018d7442fa294 100644 (file)
@@ -8089,6 +8089,19 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
         //Location of the xml file
         $xml_file = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code."/moodle.xml";
 
+        // Re-assure xml file is in place before any further process
+        if (! $status = restore_check_moodle_file($xml_file)) {
+            if (!is_file($xml_file)) {
+                $errorstr = 'Error checking backup file. moodle.xml not found. Session problem?';
+            } else {
+                $errorstr = 'Error checking backup file. moodle.xml is incorrect or corrupted. Session problem?';
+            }
+            if (!defined('RESTORE_SILENTLY')) {
+                echo $OUTPUT->notification($errorstr);
+            }
+            return false;
+        }
+
         //Preprocess the moodle.xml file spliting into smaller chucks (modules, users, logs...)
         //for optimal parsing later in the restore process.
         if (!empty($CFG->experimentalsplitrestore)) {
@@ -8097,10 +8110,9 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             //First of all, split moodle.xml into handy files
             if (!restore_split_xml ($xml_file, $restore)) {
+                $errorstr = "Error proccessing moodle.xml file. Process ended.";
                 if (!defined('RESTORE_SILENTLY')) {
-                    echo $OUTPUT->notification("Error proccessing moodle.xml file. Process ended.");
-                } else {
-                    $errorstr = "Error proccessing moodle.xml file. Process ended.";
+                    echo $OUTPUT->notification($errorstr);
                 }
                 return false;
             }