Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 260a664

Browse files
committed
there may be multiple fastroute cache file to delete issue fixed
1 parent 1891836 commit 260a664

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Cache/ClearRouteDispatcherData.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@ protected function execute(InputInterface $input, OutputInterface $output) : voi
2828
{
2929
$config = $this->container->get('config');
3030
$routeCacheFile = $config['app']['cache_file'] ?? '';
31-
$unlinkResult = file_exists((string) $routeCacheFile)
32-
? unlink($routeCacheFile) ? 'deleted.' : 'could\'t deleted'
33-
: 'does not exist!';
34-
$output->writeln('Route cache file ' .$routeCacheFile . ' ' . $unlinkResult);
31+
if (trim((string) $routeCacheFile) !== '') {
32+
$folder = dirname($routeCacheFile);
33+
$files = glob($folder . '/*fastroute.cache');
34+
$output->writeln('Fastroute cache files under ' . $folder . ' will be deleted.');
35+
foreach ($files as $file) {
36+
$unlinkResult = file_exists($file)
37+
? (unlink($file) === true) ? 'deleted.' : 'could\'t deleted'
38+
: ' file does not exist';
39+
$output->writeln($file . ' ' . $unlinkResult);
40+
}
41+
}
3542
}
3643
}

0 commit comments

Comments
 (0)