// Prepare the import UI $backup = new import_ui($bc, array('importid' => $importcourse->id, 'target' => $restoretarget)); // Process the current stage $backup->process(); // If this is the confirmation stage remove the filename setting if ($backup->get_stage() == backup_ui::STAGE_CONFIRMATION) { $backup->get_setting('filename')->set_visibility(backup_setting::HIDDEN); } // If it's the final stage process the import if ($backup->get_stage() == backup_ui::STAGE_FINAL) { echo $OUTPUT->header(); // Display an extra progress bar so that we can show the current stage. echo html_writer::start_div('', array('id' => 'executionprogress')); echo $renderer->progress_bar($backup->get_progress_bar()); // Start the progress display - we split into 2 chunks for backup and restore. $progress = new core_backup_display_progress(); $progress->start_progress('', 2); $backup->get_controller()->set_progress($progress); // Prepare logger for backup. $logger = new core_backup_html_logger($CFG->debugdeveloper ? backup::LOG_DEBUG : backup::LOG_INFO); $backup->get_controller()->add_logger($logger); // First execute the backup $backup->execute(); $backup->destroy(); unset($backup); // Note that we've done that progress. $progress->progress(1); // Check whether the backup directory still exists. If missing, something // went really wrong in backup, throw error. Note that backup::MODE_IMPORT // backups don't store resulting files ever $tempdestination = $CFG->tempdir . '/backup/' . $backupid;
/** * Finishes parent display then closes div and hides it. * * @see core_backup_display_progress::end_html() */ public function end_html() { parent::end_html(); echo html_writer::end_div(); echo html_writer::script('document.getElementById("' . $this->id . '").style.display = "none"'); }