Merge branch 'MDL-57576-33-updatefeedbackfile' of git://github.com/roperto/moodle

This commit is contained in:
David Monllao 2017-02-20 12:27:26 +01:00
commit 74d2cce2fa

View File

@ -179,6 +179,20 @@ class assign_feedback_file extends assign_feedback_plugin {
// automatically with current timestamp.
continue;
}
$existingfile = $fs->get_file(
$newfilerecord->contextid,
$newfilerecord->component,
$newfilerecord->filearea,
$newfilerecord->itemid,
$file->get_filepath(),
$file->get_filename()
);
if ($existingfile) {
// If the file already exists, remove it so it can be updated.
$existingfile->delete();
}
$newfile = $fs->create_file_from_storedfile($newfilerecord, $file);
}
}