Permalink
Browse files

MDL-18469 Minor changes to restore silenty/import before implementing…

… checksum
  • Loading branch information...
stronk7
stronk7 committed Oct 2, 2009
1 parent cb09ed7 commit ce261c444d28d47e8bfeda6c871710b4fa366af1
Showing with 6 additions and 3 deletions.
  1. +6 −3 backup/restorelib.php
View
@@ -7716,7 +7716,7 @@ function restore_precheck($id,$file,&$errorstr,$noredirect=false) {
}
//We compare Moodle's versions
- if ($CFG->version < $info->backup_moodle_version && $status) {
+ if ($status && $CFG->version < $info->backup_moodle_version) {
$message = new object();
$message->serverversion = $CFG->version;
$message->serverrelease = $CFG->release;
@@ -7786,8 +7786,9 @@ function restore_setup_for_check(&$restore,$backup_unique_code) {
global $SESSION;
$restore->backup_unique_code=$backup_unique_code;
$restore->users = 2; // yuk
- $restore->course_files = $SESSION->restore->restore_course_files;
- $restore->site_files = $SESSION->restore->restore_site_files;
+ // we set these from restore object on silent restore and from info (backup) object on import
+ $restore->course_files = isset($SESSION->restore->restore_course_files) ? $SESSION->restore->restore_course_files : $SESSION->info->backup_course_files;
+ $restore->site_files = isset($SESSION->restore->restore_site_files) ? $SESSION->restore->restore_site_files : $SESSION->info->backup_site_files;
if ($allmods = get_records("modules")) {
foreach ($allmods as $mod) {
$modname = $mod->name;
@@ -7803,12 +7804,14 @@ function restore_setup_for_check(&$restore,$backup_unique_code) {
function backup_to_restore_array($backup,$k=0) {
if (is_array($backup) ) {
+ $restore = array();
foreach ($backup as $key => $value) {
$newkey = str_replace('backup','restore',$key);
$restore[$newkey] = backup_to_restore_array($value,$key);
}
}
else if (is_object($backup)) {
+ $restore = new stdClass();
$tmp = get_object_vars($backup);
foreach ($tmp as $key => $value) {
$newkey = str_replace('backup','restore',$key);

0 comments on commit ce261c4

Please sign in to comment.