MDL-36959 file_storage: Preserve each file in a hash collision

This commit is contained in:
Damyon Wiese 2013-04-22 12:07:43 +08:00
parent e9cd87eef2
commit 946f2b0826

View File

@ -1607,7 +1607,7 @@ class file_storage {
if (sha1_file($hashfile) === $contenthash) {
// Jackpot! We have a sha1 collision.
mkdir("$this->filedir/jackpot/", $this->dirpermissions, true);
copy($hashfile, "$this->filedir/jackpot/{$contenthash}_1");
copy($pathname, "$this->filedir/jackpot/{$contenthash}_1");
copy($hashfile, "$this->filedir/jackpot/{$contenthash}_2");
throw new file_pool_content_exception($contenthash);
}