File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/Symfony/Component/HttpKernel Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -584,6 +584,11 @@ protected function initializeContainer()
584
584
file_put_contents ($ this ->getCacheDir ().'/ ' .$ class .'Compiler.log ' , null !== $ container ? implode ("\n" , $ container ->getCompiler ()->getLog ()) : '' );
585
585
}
586
586
}
587
+
588
+ if ($ oldContainer = file_exists ($ cache ->getPath ()) ? @include $ cache ->getPath () : false ) {
589
+ $ oldContainer = new \ReflectionClass ($ oldContainer );
590
+ }
591
+
587
592
$ this ->dumpContainer ($ cache , $ container , $ class , $ this ->getContainerBaseClass ());
588
593
589
594
$ fresh = false ;
@@ -592,7 +597,15 @@ protected function initializeContainer()
592
597
$ this ->container = require $ cache ->getPath ();
593
598
$ this ->container ->set ('kernel ' , $ this );
594
599
595
- if (!$ fresh && $ this ->container ->has ('cache_warmer ' )) {
600
+ if ($ fresh ) {
601
+ return ;
602
+ }
603
+
604
+ if ($ oldContainer && get_class ($ this ->container ) !== $ oldContainer ->name ) {
605
+ (new Filesystem ())->remove (dirname ($ oldContainer ->getFileName ()));
606
+ }
607
+
608
+ if ($ this ->container ->has ('cache_warmer ' )) {
596
609
$ this ->container ->get ('cache_warmer ' )->warmUp ($ this ->container ->getParameter ('kernel.cache_dir ' ));
597
610
}
598
611
}
You can’t perform that action at this time.
0 commit comments