mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-57576 assignment: Overwrite feedback file if it has the same name.
This commit is contained in:
parent
c4cf1c60f5
commit
b51f6864c1
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user