Skip to content
Permalink
Browse files

Optimize FileEngine::gc()

SplFileObject constructor throws an exception if the file does not exist or is a directory.
  • Loading branch information...
majna committed Aug 20, 2014
1 parent 9049997 commit 380ac9e88ed91ab32e29b730a34588c6fa52ebaf
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/Cake/Cache/Engine/FileEngine.php
@@ -271,13 +271,10 @@ protected function _clearDirectory($path, $now, $threshold) {
if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) {
continue;
}
$filePath = $path . $entry;
if (!file_exists($filePath) || is_dir($filePath)) {
continue;
}
try {
$file = new SplFileObject($path . $entry, 'r');
} catch (RuntimeException $e) {
} catch (Exception $e) {
continue;
}

0 comments on commit 380ac9e

Please sign in to comment.
You can’t perform that action at this time.