fix: remove unnecessary calls to purgeCache (#3502)

This commit is contained in:
Dag 2023-07-06 18:52:19 +02:00 committed by GitHub
parent 965d7d44c5
commit 5e22459eb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 19 deletions

View file

@ -78,12 +78,19 @@ class FileCache implements CacheInterface
);
foreach ($cacheIterator as $cacheFile) {
if (in_array($cacheFile->getBasename(), ['.', '..', '.gitkeep'])) {
$basename = $cacheFile->getBasename();
$excluded = [
'.' => true,
'..' => true,
'.gitkeep' => true,
];
if (isset($excluded[$basename])) {
continue;
} elseif ($cacheFile->isFile()) {
if (filemtime($cacheFile->getPathname()) < time() - $seconds) {
$filepath = $cacheFile->getPathname();
if (filemtime($filepath) < time() - $seconds) {
// todo: sometimes this file doesn't exists
unlink($cacheFile->getPathname());
unlink($filepath);
}
}
}