From 5758d88262f5db9f29a31e18e68598d5e07f20f7 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 5 Oct 2009 10:31:46 +0000 Subject: [PATCH] MDL-18469 restore missing session info - add a quick re-test of xml file before any further processing by restore_execute(). More coming. Merged from 19_STABLE --- backup/restorelib.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backup/restorelib.php b/backup/restorelib.php index 9e1c671065..47e0f9654d 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -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; } -- 2.39.5