Merge branch 'MDL-43390_26' of git://github.com/dmonllao/moodle into MOODLE_26_STABLE

This commit is contained in:
Sam Hemelryk 2014-07-28 12:22:45 +12:00
commit 3390644156

View file

@ -1721,6 +1721,8 @@ class file_storage {
* @return array (contenthash, filesize, newfile)
*/
public function add_string_to_pool($content) {
global $CFG;
$contenthash = sha1($content);
$filesize = strlen($content); // binary length
@ -1755,7 +1757,13 @@ class file_storage {
// Hopefully this works around most potential race conditions.
$prev = ignore_user_abort(true);
$newsize = file_put_contents($hashfile.'.tmp', $content, LOCK_EX);
if (!empty($CFG->preventfilelocking)) {
$newsize = file_put_contents($hashfile.'.tmp', $content);
} else {
$newsize = file_put_contents($hashfile.'.tmp', $content, LOCK_EX);
}
if ($newsize === false) {
// Borked permissions most likely.
ignore_user_abort($prev);