Skip to content

Commit

Permalink
Do not attempt to clear old containers if the directory does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 8, 2021
1 parent 9b53878 commit 2427b83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/DependencyInjection/ContainerFactory.php
Expand Up @@ -141,8 +141,13 @@ public function clearOldContainers(string $tempDirectory): void
$configurator->setDebugMode(true);
$configurator->setTempDirectory($tempDirectory);

$containerDirectory = $configurator->getContainerCacheDirectory();
if (!is_dir($containerDirectory)) {
return;
}

$finder = new Finder();
$finder->name('Container_*')->in($configurator->getContainerCacheDirectory());
$finder->name('Container_*')->in($containerDirectory);
$twoDaysAgo = time() - 24 * 60 * 60 * 2;

foreach ($finder as $containerFile) {
Expand Down

0 comments on commit 2427b83

Please sign in to comment.