backup MDL-24962 Backup, Restore, and Import all now explicitly destroy the UI, controller, and stage objects upon completion.

This commit is contained in:
Sam Hemelryk
2010-11-18 02:09:23 +00:00
parent 696b250217
commit 44bb101dfe
4 changed files with 20 additions and 1 deletions
+2
View File
@@ -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();
+5 -1
View File
@@ -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();
+2
View File
@@ -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();
+11
View File
@@ -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