Merge branch 'MDL-57801-master' of https://github.com/lucisgit/moodle

This commit is contained in:
David Monllao
2017-02-20 10:10:01 +01:00
+4 -3
View File
@@ -421,12 +421,13 @@ class file_system_filedir extends file_system {
@unlink($hashfile.'.tmp');
if (!copy($pathname, $hashfile.'.tmp')) {
// Borked permissions or out of disk space.
@unlink($hashfile.'.tmp');
ignore_user_abort($prev);
throw new file_exception('storedfilecannotcreatefile');
}
if (filesize($hashfile.'.tmp') !== $filesize) {
// This should not happen.
unlink($hashfile.'.tmp');
if (sha1_file($hashfile.'.tmp') !== $contenthash) {
// Highly unlikely edge case, but this can happen on an NFS volume with no space remaining.
@unlink($hashfile.'.tmp');
ignore_user_abort($prev);
throw new file_exception('storedfilecannotcreatefile');
}