[HttpKernel] Don't clean legacy containers that are still loaded
This commit is contained in:
parent
ea25fec603
commit
be8dbc3660
@ -670,9 +670,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
// Because concurrent requests might still be using them,
|
// Because concurrent requests might still be using them,
|
||||||
// old container files are not removed immediately,
|
// old container files are not removed immediately,
|
||||||
// but on a next dump of the container.
|
// but on a next dump of the container.
|
||||||
|
static $legacyContainers = array();
|
||||||
$oldContainerDir = dirname($oldContainer->getFileName());
|
$oldContainerDir = dirname($oldContainer->getFileName());
|
||||||
foreach (glob(dirname($oldContainerDir).'/*.legacy') as $legacyContainer) {
|
$legacyContainers[$oldContainerDir.'.legacy'] = true;
|
||||||
if ($oldContainerDir.'.legacy' !== $legacyContainer && @unlink($legacyContainer)) {
|
foreach (glob(dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
|
||||||
|
if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
|
||||||
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
|
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user