diff --git a/backup/backup.php b/backup/backup.php index 23742b2c465..7d3170d9684 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -100,4 +100,6 @@ if ($backup->enforce_changed_dependencies()) { } echo $renderer->progress_bar($backup->get_progress_bar()); echo $backup->display(); +$backup->destroy(); +unset($backup); echo $OUTPUT->footer(); \ No newline at end of file diff --git a/backup/import.php b/backup/import.php index 0cc71fb5bcb..6ba891171d1 100644 --- a/backup/import.php +++ b/backup/import.php @@ -90,6 +90,8 @@ if ($backup->get_stage() == backup_ui::STAGE_CONFIRMATION) { if ($backup->get_stage() == backup_ui::STAGE_FINAL) { // First execute the backup $backup->execute(); + $backup->destroy(); + unset($backup); // Check whether the backup directory still exists. If missing, something // went really wrong in backup, throw error. Note that backup::MODE_IMPORT @@ -156,4 +158,6 @@ if ($backup->enforce_changed_dependencies()) { } echo $renderer->progress_bar($backup->get_progress_bar()); echo $backup->display(); -echo $OUTPUT->footer(); +$backup->destroy(); +unset($backup); +echo $OUTPUT->footer(); \ No newline at end of file diff --git a/backup/restore.php b/backup/restore.php index 084ab1f05c6..6d49b640868 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -54,4 +54,6 @@ if (!$restore->is_independent() && $restore->enforce_changed_dependencies()) { } echo $renderer->progress_bar($restore->get_progress_bar()); echo $restore->display($renderer); +$restore->destroy(); +unset($restore); echo $OUTPUT->footer(); diff --git a/backup/util/ui/base_ui.class.php b/backup/util/ui/base_ui.class.php index fce02a1da53..e15612030e4 100644 --- a/backup/util/ui/base_ui.class.php +++ b/backup/util/ui/base_ui.class.php @@ -72,6 +72,17 @@ abstract class base_ui { // Process UI event before to be safe $this->controller->process_ui_event(); } + /** + * Destorys the backup controller and the loaded stage. + */ + public function destroy() { + + if ($this->controller) { + $this->controller->destroy(); + } + unset($this->stage); + + } /** * Intialises what ever stage is requested. If none are requested we check * params for 'stage' and default to initial