From 6917949483f23fe39db6719c83cb16a11ff52fd1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 10 Apr 2006 18:34:37 +0000 Subject: [PATCH] Deleting $SESSION structures before starting manual restore. --- backup/restore.php | 23 +++++++++++++++++++++-- files/index.php | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/backup/restore.php b/backup/restore.php index 16fc52e275..e7d9736838 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 cef37a0c06..7e36b89f7f 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); -- 2.39.5