Merge branch 'MDL-56136' of git://github.com/timhunt/moodle

This commit is contained in:
Dan Poltawski 2016-10-25 20:44:42 +01:00
commit a360594259
2 changed files with 7 additions and 2 deletions

View File

@ -93,7 +93,9 @@ if ($action == 'choosebackupfile') {
// If it's some weird other kind of file then use old code.
$filename = restore_controller::get_tempdir_name($courseid, $USER->id);
$pathname = $tmpdir . '/' . $filename;
$fileinfo->copy_to_pathname($pathname);
if (!$fileinfo->copy_to_pathname($pathname)) {
throw new restore_ui_exception('errorcopyingbackupfile', null, $pathname);
}
$restore_url = new moodle_url('/backup/restore.php', array(
'contextid' => $contextid, 'filename' => $filename));
}
@ -115,7 +117,9 @@ $data = $form->get_data();
if ($data && has_capability('moodle/restore:uploadfile', $context)) {
$filename = restore_controller::get_tempdir_name($courseid, $USER->id);
$pathname = $tmpdir . '/' . $filename;
$form->save_file('backupfile', $pathname);
if (!$form->save_file('backupfile', $pathname)) {
throw new restore_ui_exception('errorcopyingbackupfile', null, $pathname);
}
$restore_url = new moodle_url('/backup/restore.php', array('contextid'=>$contextid, 'filename'=>$filename));
redirect($restore_url);
die;

View File

@ -118,6 +118,7 @@ $string['currentstage16'] = 'Complete';
$string['enterasearch'] = 'Enter a search';
$string['error_block_for_module_not_found'] = 'Orphan block instance (id: {$a->bid}) for course module (id: {$a->mid}) found. This block will not be backed up';
$string['error_course_module_not_found'] = 'Orphan course module (id: {$a}) found. This module will not be backed up.';
$string['errorcopyingbackupfile'] = "Failed to copy the backup file to the temporary folder before restoring.";
$string['errorfilenamerequired'] = 'You must enter a valid filename for this backup';
$string['errorfilenamemustbezip'] = 'The filename you enter must be a ZIP file and have the .mbz extension';
$string['errorminbackup20version'] = 'This backup file has been created with one development version of Moodle backup ({$a->backup}). Minimum required is {$a->min}. Cannot be restored.';