Merge branch 'wip-MDL-49995-master' of git://github.com/marinaglancy/moodle
authorDamyon Wiese <damyon@moodle.com>
Mon, 18 Dec 2017 03:35:29 +0000 (11:35 +0800)
committerDamyon Wiese <damyon@moodle.com>
Mon, 18 Dec 2017 03:35:29 +0000 (11:35 +0800)
lib/filestorage/stored_file.php

index 36f186f..c1a4254 100644 (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);
     }
 
     /**