Skip to content

Commit

Permalink
Merge branch 'MDL-57801-master' of https://github.com/lucisgit/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonllao committed Feb 20, 2017
2 parents 2e57a90 + efa7d24 commit 742043f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/filestorage/file_system_filedir.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,13 @@ public function add_file_from_path($pathname, $contenthash = null) {
@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');
}
Expand Down

0 comments on commit 742043f

Please sign in to comment.