mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-33096 update the file's timemodified if it was changed in the draft area
Previously up to 2.2, new file records were created for all files that were modified in the draft area - see file_save_draft_area_files(). The commit aba1e17dd7ffa5e42d309fb2efe7945aeb3b3d39 introduced a new way of re-using the previous file's record. We need to transfer the timemodified of the file in the draft area into the file in the real area when saving the draft area to achieve the same behaviour now in 2.3. Note this may eventually lead to kinda weird situation when the file was created say on a certain timecreated but then was replaced with another file that has timemodified set to a lower value (in other words, the file will look as if it was firstly modified and then created). This case should be handled by the filepicker if it is seen as the issue.
This commit is contained in:
parent
3333e7e20c
commit
f653c9d830
@ -822,6 +822,11 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
|
||||
$oldfile->set_filesize($newfile->get_filesize());
|
||||
}
|
||||
|
||||
// Update file timemodified
|
||||
if ($oldfile->get_timemodified() != $newfile->get_timemodified()) {
|
||||
$oldfile->set_timemodified($newfile->get_timemodified());
|
||||
}
|
||||
|
||||
// unchanged file or directory - we keep it as is
|
||||
unset($newhashes[$oldhash]);
|
||||
if (!$oldfile->is_directory()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user