[BUGFIX] Clear statcache after writing file contents 78/26278/3
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Tue, 10 Dec 2013 15:21:20 +0000 (16:21 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 11 Dec 2013 08:20:28 +0000 (09:20 +0100)
To make sure calls to filesize() etc. return correct values the PHP
method clearstatcache() is called in the LocalDriver after contents
were written to a file.

Resolves: #54302
Releases: 6.2
Change-Id: Ia30e519d17aa3cf37856096f1cdac567b5729aec
Reviewed-on: https://review.typo3.org/26278
Reviewed-by: Markus Klein
Reviewed-by: Frans Saris
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index 84b86c1..bb98ba7 100644 (file)
@@ -1243,6 +1243,10 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
        public function setFileContents(FileInterface $file, $contents) {
                $filePath = $this->getAbsolutePath($file);
                $result = file_put_contents($filePath, $contents);
+
+               // Make sure later calls to filesize() etc. return correct values.
+               clearstatcache(TRUE, $filePath);
+
                if ($result === FALSE) {
                        throw new \RuntimeException('Setting contents of file "' . $file->getIdentifier() . '" failed.', 1325419305);
                }