From 6f72871ca5970df6f288d721f3bdc7f79dd037c9 Mon Sep 17 00:00:00 2001 From: J0WI Date: Fri, 3 Jul 2020 22:42:27 +0200 Subject: [PATCH 1/2] clearstatcache() on rmdir Signed-off-by: J0WI --- lib/private/Files/Storage/Local.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 4cf3ac4799fa5..a8fa32f608e7b 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -108,6 +108,7 @@ public function rmdir($path) { * @var \SplFileInfo $file */ $file = $it->current(); + clearstatcache(true, $this->getSourcePath($file)); if (in_array($file->getBasename(), ['.', '..'])) { $it->next(); continue; @@ -118,6 +119,7 @@ public function rmdir($path) { } $it->next(); } + clearstatcache(true, $this->getSourcePath($path)); return rmdir($this->getSourcePath($path)); } catch (\UnexpectedValueException $e) { return false; From be73fd90fc51440474d0f5e801934cafd327b4df Mon Sep 17 00:00:00 2001 From: J0WI Date: Fri, 3 Jul 2020 22:44:31 +0200 Subject: [PATCH 2/2] Only clear the realpath cache Signed-off-by: J0WI --- lib/private/Files/Storage/Local.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index a8fa32f608e7b..6d350512b221b 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -142,8 +142,8 @@ public function is_file($path) { } public function stat($path) { - clearstatcache(); $fullPath = $this->getSourcePath($path); + clearstatcache(true, $fullPath); $statResult = stat($fullPath); if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) { $filesize = $this->filesize($path); @@ -158,7 +158,7 @@ public function stat($path) { */ public function getMetaData($path) { $fullPath = $this->getSourcePath($path); - clearstatcache(); + clearstatcache(true, $fullPath); $stat = @stat($fullPath); if (!$stat) { return null;