Skip to content

Commit be8dbc3

Browse files
[HttpKernel] Don't clean legacy containers that are still loaded
1 parent ea25fec commit be8dbc3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,11 @@ protected function initializeContainer()
670670
// Because concurrent requests might still be using them,
671671
// old container files are not removed immediately,
672672
// but on a next dump of the container.
673+
static $legacyContainers = array();
673674
$oldContainerDir = dirname($oldContainer->getFileName());
674-
foreach (glob(dirname($oldContainerDir).'/*.legacy') as $legacyContainer) {
675-
if ($oldContainerDir.'.legacy' !== $legacyContainer && @unlink($legacyContainer)) {
675+
$legacyContainers[$oldContainerDir.'.legacy'] = true;
676+
foreach (glob(dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
677+
if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
676678
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
677679
}
678680
}

0 commit comments

Comments
 (0)