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

Commit

Permalink
there may be multiple fastroute cache file to delete issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Jul 23, 2018
1 parent 1891836 commit 260a664
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Cache/ClearRouteDispatcherData.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ protected function execute(InputInterface $input, OutputInterface $output) : voi
{
$config = $this->container->get('config');
$routeCacheFile = $config['app']['cache_file'] ?? '';
$unlinkResult = file_exists((string) $routeCacheFile)
? unlink($routeCacheFile) ? 'deleted.' : 'could\'t deleted'
: 'does not exist!';
$output->writeln('Route cache file ' .$routeCacheFile . ' ' . $unlinkResult);
if (trim((string) $routeCacheFile) !== '') {
$folder = dirname($routeCacheFile);
$files = glob($folder . '/*fastroute.cache');
$output->writeln('Fastroute cache files under ' . $folder . ' will be deleted.');
foreach ($files as $file) {
$unlinkResult = file_exists($file)
? (unlink($file) === true) ? 'deleted.' : 'could\'t deleted'
: ' file does not exist';
$output->writeln($file . ' ' . $unlinkResult);
}
}
}
}

0 comments on commit 260a664

Please sign in to comment.