diff --git a/lib/filestorage/stored_file.php b/lib/filestorage/stored_file.php index e1c3e738d09..aec547d3cfe 100644 --- a/lib/filestorage/stored_file.php +++ b/lib/filestorage/stored_file.php @@ -297,7 +297,9 @@ class stored_file { $filerecord->filesize = $newfile->get_filesize(); $filerecord->referencefileid = $newfile->get_referencefileid(); $filerecord->userid = $newfile->get_userid(); + $oldcontenthash = $this->get_contenthash(); $this->update($filerecord); + $this->filesystem->remove_file($oldcontenthash); } /**