mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-38196 Backup/restore: Display log if non-empty
When doing a backup or restore operation with the normal user interface, if there is anything in the backup/restore log, it will now be displayed at the end of the process below the Continue button. If you have developer debugging enabled, it sets the display level to LOG_DEBUG and there will always be content in the log. Otherwise, it uses LOG_INFO which generally means the log is empty, and nothing displays (no visible change for users).
This commit is contained in:
parent
56cc9b387e
commit
77b3d9dfdf
15 changed files with 220 additions and 73 deletions
|
@ -99,6 +99,10 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
|
|||
$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();
|
||||
|
@ -123,6 +127,10 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
|
|||
// (the precheck and then the actual restore).
|
||||
$progress->start_progress('Restore process', 2);
|
||||
$rc->set_progress($progress);
|
||||
|
||||
// Set logger for restore.
|
||||
$rc->add_logger($logger);
|
||||
|
||||
// Convert the backup if required.... it should NEVER happed
|
||||
if ($rc->get_status() == backup::STATUS_REQUIRE_CONV) {
|
||||
$rc->convert();
|
||||
|
@ -178,6 +186,13 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
|
|||
}
|
||||
echo $OUTPUT->notification(get_string('importsuccess', 'backup'), 'notifysuccess');
|
||||
echo $OUTPUT->continue_button(new moodle_url('/course/view.php', array('id'=>$course->id)));
|
||||
|
||||
// Get and display log data if there was any.
|
||||
$loghtml = $logger->get_html();
|
||||
if ($loghtml != '') {
|
||||
echo $renderer->log_display($loghtml);
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
die();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue