diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Storage/Local.php | 6 | ||||
-rw-r--r-- | lib/private/Preview/Generator.php | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 0b636d06bde..552e996b90b 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -109,6 +109,7 @@ class Local extends \OC\Files\Storage\Common { * @var \SplFileInfo $file */ $file = $it->current(); + clearstatcache(true, $this->getSourcePath($file)); if (in_array($file->getBasename(), ['.', '..'])) { $it->next(); continue; @@ -119,6 +120,7 @@ class Local extends \OC\Files\Storage\Common { } $it->next(); } + clearstatcache(true, $this->getSourcePath($path)); return rmdir($this->getSourcePath($path)); } catch (\UnexpectedValueException $e) { return false; @@ -141,8 +143,8 @@ class Local extends \OC\Files\Storage\Common { } 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); @@ -157,7 +159,7 @@ class Local extends \OC\Files\Storage\Common { */ public function getMetaData($path) { $fullPath = $this->getSourcePath($path); - clearstatcache(); + clearstatcache(true, $fullPath); $stat = @stat($fullPath); if (!$stat) { return null; diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index f7aed987d89..e47a7e5927c 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -192,6 +192,12 @@ class Generator { } } + // Free memory being used by the embedded image resource. Without this the image is kept in memory indefinitely. + // Garbage Collection does NOT free this memory. We have to do it ourselves. + if ($maxPreviewImage instanceof \OC_Image) { + $maxPreviewImage->destroy(); + } + return $preview; } |