MDL-39177 File reference is not updated when overwriting the file
This commit is contained in:
+7
-2
@@ -828,9 +828,14 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
|
||||
$oldfile->set_timemodified($newfile->get_timemodified());
|
||||
}
|
||||
|
||||
if ($newfile->is_external_file() && !$allowreferences) {
|
||||
continue;
|
||||
}
|
||||
// Replaced file content
|
||||
if ($oldfile->get_contenthash() != $newfile->get_contenthash() || $oldfile->get_filesize() != $newfile->get_filesize()) {
|
||||
$oldfile->replace_content_with($newfile);
|
||||
else if ($oldfile->get_contenthash() != $newfile->get_contenthash() ||
|
||||
$oldfile->get_filesize() != $newfile->get_filesize() ||
|
||||
$oldfile->get_referencefileid() != $newfile->get_referencefileid()) {
|
||||
$oldfile->replace_file_with($newfile);
|
||||
// push changes to all local files that are referencing this file
|
||||
$fs->update_references_to_storedfile($oldfile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user