File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
src/Symfony/Component/HttpKernel Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ CHANGELOG
6
6
7
7
* made ` WarmableInterface::warmUp() ` return a list of classes or files to preload on PHP 7.4+;
8
8
not returning an array is deprecated
9
+ * made kernels implementing ` WarmableInterface ` be part of the cache warmup stage
9
10
* deprecated support for ` service:action ` syntax to reference controllers, use ` serviceOrFqcn::method ` instead
10
11
* allowed using public aliases to reference controllers
11
12
* added session usage reporting when the ` _stateless ` attribute of the request is set to ` true `
Original file line number Diff line number Diff line change 35
35
use Symfony \Component \HttpFoundation \Request ;
36
36
use Symfony \Component \HttpFoundation \Response ;
37
37
use Symfony \Component \HttpKernel \Bundle \BundleInterface ;
38
+ use Symfony \Component \HttpKernel \CacheWarmer \WarmableInterface ;
38
39
use Symfony \Component \HttpKernel \Config \FileLocator ;
39
40
use Symfony \Component \HttpKernel \DependencyInjection \AddAnnotatedClassesToCachePass ;
40
41
use Symfony \Component \HttpKernel \DependencyInjection \MergeExtensionConfigurationPass ;
@@ -563,12 +564,14 @@ protected function initializeContainer()
563
564
touch ($ oldContainerDir .'.legacy ' );
564
565
}
565
566
567
+ $ preload = $ this instanceof WarmableInterface ? (array ) $ this ->warmUp ($ this ->container ->getParameter ('kernel.cache_dir ' )) : [];
568
+
566
569
if ($ this ->container ->has ('cache_warmer ' )) {
567
- $ preload = (array ) $ this ->container ->get ('cache_warmer ' )->warmUp ($ this ->container ->getParameter ('kernel.cache_dir ' ));
570
+ $ preload = array_merge ($ preload , (array ) $ this ->container ->get ('cache_warmer ' )->warmUp ($ this ->container ->getParameter ('kernel.cache_dir ' )));
571
+ }
568
572
569
- if (method_exists (Preloader::class, 'append ' ) && file_exists ($ preloadFile = $ cacheDir .'/ ' .$ class .'.preload.php ' )) {
570
- Preloader::append ($ preloadFile , $ preload );
571
- }
573
+ if ($ preload && method_exists (Preloader::class, 'append ' ) && file_exists ($ preloadFile = $ cacheDir .'/ ' .$ class .'.preload.php ' )) {
574
+ Preloader::append ($ preloadFile , $ preload );
572
575
}
573
576
}
574
577
You can’t perform that action at this time.
0 commit comments