Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-41163 Restore: Large course restore timeout on schema page

  • Loading branch information...
commit 097abcc59c101d85bd68a8c7a7adefd45cac64b1 1 parent e78a2d0
@sammarshallou sammarshallou authored
Showing with 15 additions and 7 deletions.
  1. +15 −7 backup/util/ui/restore_ui_stage.class.php
View
22 backup/util/ui/restore_ui_stage.class.php
@@ -475,8 +475,9 @@ protected function initialise_stage_form() {
if ($this->stageform === null) {
$form = new restore_schema_form($this, $PAGE->url);
$tasks = $this->ui->get_tasks();
- $content = '';
$courseheading = false;
+
+ $allsettings = array();
foreach ($tasks as $task) {
if (!($task instanceof restore_root_task)) {
if (!$courseheading) {
@@ -484,13 +485,11 @@ protected function initialise_stage_form() {
$form->add_heading('coursesettings', get_string('coursesettings', 'backup'));
$courseheading = true;
}
- // First add each setting
- foreach ($task->get_settings() as $setting) {
- $form->add_setting($setting, $task);
- }
- // The add all the dependencies
+ // Put each setting into an array of settings to add. Adding
+ // a setting individually is a very slow operation, so we add
+ // them all in a batch later on.
foreach ($task->get_settings() as $setting) {
- $form->add_dependencies($setting);
+ $allsettings[] = array($setting, $task);
}
} else if ($this->ui->enforce_changed_dependencies()) {
// Only show these settings if dependencies changed them.
@@ -505,6 +504,15 @@ protected function initialise_stage_form() {
}
}
}
+
+ // Actually add all the settings that we put in the array.
+ $form->add_settings($allsettings);
+
+ // Add the dependencies for all the settings.
+ foreach ($allsettings as $settingtask) {
+ $form->add_dependencies($settingtask[0]);
+ }
+
$this->stageform = $form;
}
return $this->stageform;
Please sign in to comment.
Something went wrong with that request. Please try again.