From e3a3ca0c76728589e6677d55f26bcb766bb50938 Mon Sep 17 00:00:00 2001 From: Dominik Hebeler Date: Thu, 5 Dec 2019 16:11:13 +0100 Subject: [PATCH] fixed error in cache gc --- app/Console/Commands/CacheGC.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/CacheGC.php b/app/Console/Commands/CacheGC.php index a62a8145..fbe8d1f9 100644 --- a/app/Console/Commands/CacheGC.php +++ b/app/Console/Commands/CacheGC.php @@ -48,11 +48,11 @@ class CacheGC extends Command } try { - $iterator = new \RecursiveDirectoryIterator($cachedir); - $iterator->setFlags(\RecursiveDirectoryIterator::SKIP_DOTS); - $files = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); - foreach ($files as $file) { - $file = realpath($file); + foreach (new \DirectoryIterator($cachedir) as $fileInfo) { + if ($fileInfo->isDot()) { + continue; + } + $file = $fileInfo->getPathname(); $basename = basename($file); if (!is_dir($file) && $basename !== "cache.gc" && $basename !== ".gitignore") { $fp = fopen($file, 'r'); @@ -80,5 +80,6 @@ class CacheGC extends Command } finally { unlink($lockfile); } + } } -- GitLab