MDL-66225 Backup: fix irrecoverable state

Fix condition where if an asynchronous backup
completes via the UI and the user refreshes the
page a new backup was created with a mismatched
backup id.
This caused a permanently failing ad-hoc task
and blocked further backups for that course.
This commit is contained in:
Matt Porritt
2019-10-23 04:18:42 +00:00
committed by Matt Porritt
parent 4fef7d1c87
commit bf0a0ed189
+3
View File
@@ -123,6 +123,9 @@ if (!async_helper::is_async_pending($id, 'course', 'backup')) {
if (!($bc = backup_ui::load_controller($backupid))) {
$bc = new backup_controller($type, $id, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, $backupmode, $USER->id);
// The backup id did not relate to a valid controller so we made a new controller.
// Now we need to reset the backup id to match the new controller.
$backupid = $bc->get_backupid();
}
// Prepare a progress bar which can display optionally during long-running