diff --git a/backup/restore.php b/backup/restore.php index 16fc52e2755..e7d97368389 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -15,14 +15,34 @@ //Optional $id = optional_param( 'id' ); - $file = optional_param( 'file' );; + $file = optional_param( 'file' ); $cancel = optional_param( 'cancel' ); $launch = optional_param( 'launch' ); $to = optional_param( 'to' ); + $method = optional_param( 'method' ); //Check login require_login(); +/// With method=manual, we come from the FileManager so we delete all the backup/restore/import session structures + if ($method == 'manual') { + if (isset($SESSION->course_header)) { + unset ($SESSION->course_header); + } + if (isset($SESSION->info)) { + unset ($SESSION->info); + } + if (isset($SESSION->backupprefs)) { + unset ($SESSION->backupprefs); + } + if (isset($SESSION->restore)) { + unset ($SESSION->restore); + } + if (isset($SESSION->import_preferences)) { + unset ($SESSION->import_preferences); + } + } + if (!$to && isset($SESSION->restore->restoreto) && isset($SESSION->restore->importing) && isset($SESSION->restore->course_id)) { $to = $SESSION->restore->course_id; } @@ -116,7 +136,6 @@ //Call the form, depending the step we are - if (!$launch) { include_once("restore_precheck.html"); } else if ($launch == "form") { diff --git a/files/index.php b/files/index.php index cef37a0c06e..7e36b89f7fa 100644 --- a/files/index.php +++ b/files/index.php @@ -571,7 +571,7 @@ echo "
".get_string("areyousuretorestorethisinfo")."
"; $restore_path = "$CFG->wwwroot/backup/restore.php"; notice_yesno (get_string("areyousuretorestorethis"), - $restore_path."?id=".$id."&file=".cleardoubleslashes($id.$wdir."/".$file), + $restore_path."?id=".$id."&file=".cleardoubleslashes($id.$wdir."/".$file)."&method=manual", "index.php?id=$id&wdir=$wdir&action=cancel"); } else { displaydir($wdir);