MDL-49995 files: delete old file when overwriting

This commit is contained in:
Marina Glancy
2017-11-28 15:03:29 +08:00
parent 20cb5f4086
commit fe1eb00c0f
+2
View File
@@ -304,7 +304,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);
}
/**