mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-48179-master' of https://github.com/sammarshallou/moodle
This commit is contained in:
commit
0d23255b89
2 changed files with 26 additions and 4 deletions
|
@ -1742,9 +1742,23 @@ class backup_zip_contents extends backup_execution_step implements file_progress
|
|||
// Get the zip packer
|
||||
$zippacker = get_file_packer('application/vnd.moodle.backup');
|
||||
|
||||
// Track overall progress for the 2 long-running steps (archive to
|
||||
// pathname, get backup information).
|
||||
$reporter = $this->task->get_progress();
|
||||
$reporter->start_progress('backup_zip_contents', 2);
|
||||
|
||||
// Zip files
|
||||
$result = $zippacker->archive_to_pathname($files, $zipfile, true, $this);
|
||||
|
||||
// If any sub-progress happened, end it.
|
||||
if ($this->startedprogress) {
|
||||
$this->task->get_progress()->end_progress();
|
||||
$this->startedprogress = false;
|
||||
} else {
|
||||
// No progress was reported, manually move it on to the next overall task.
|
||||
$reporter->progress(1);
|
||||
}
|
||||
|
||||
// Something went wrong.
|
||||
if ($result === false) {
|
||||
@unlink($zipfile);
|
||||
|
@ -1752,16 +1766,20 @@ class backup_zip_contents extends backup_execution_step implements file_progress
|
|||
}
|
||||
// Read to make sure it is a valid backup. Refer MDL-37877 . Delete it, if found not to be valid.
|
||||
try {
|
||||
backup_general_helper::get_backup_information_from_mbz($zipfile);
|
||||
backup_general_helper::get_backup_information_from_mbz($zipfile, $this);
|
||||
} catch (backup_helper_exception $e) {
|
||||
@unlink($zipfile);
|
||||
throw new backup_step_exception('error_zip_packing', '', $e->debuginfo);
|
||||
}
|
||||
|
||||
// If any progress happened, end it.
|
||||
// If any sub-progress happened, end it.
|
||||
if ($this->startedprogress) {
|
||||
$this->task->get_progress()->end_progress();
|
||||
$this->startedprogress = false;
|
||||
} else {
|
||||
$reporter->progress(2);
|
||||
}
|
||||
$reporter->end_progress();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue