File tree Expand file tree Collapse file tree 3 files changed +8
-25
lines changed
Expand file tree Collapse file tree 3 files changed +8
-25
lines changed Original file line number Diff line number Diff line change 2525 "system_config" : {
2626 "type" : " object" ,
2727 "additionalProperties" : true
28- },
29- "twig_cache_warmer" : {
30- "type" : " object" ,
31- "properties" : {
32- "enabled" : {
33- "title" : " Enable Twig cache warmer during cache:warmup" ,
34- "type" : " boolean" ,
35- "default" : false
36- }
37- },
38- "additionalProperties" : false
3928 }
4029 },
4130 "additionalProperties" : false
Original file line number Diff line number Diff line change 1010class TwigCacheKernelWarmer implements CacheWarmerInterface
1111{
1212 public function __construct (
13- private readonly TwigCacheWarmer $ twigCacheWarmer ,
14- #[Autowire('%frosh_tools.twig_cache_warmer.enabled% ' )]
15- private bool $ enabled
13+ private readonly TwigCacheWarmer $ twigCacheWarmer
1614 ) {
1715 }
1816
@@ -21,11 +19,15 @@ public function __construct(
2119 */
2220 public function warmUp (string $ cacheDir , ?string $ buildDir = null ): array
2321 {
24- if (!$ this ->enabled ) {
22+ try {
23+ return $ this ->twigCacheWarmer ->warmUp ($ cacheDir );
24+ } catch (\Throwable $ e ) {
25+ if (\defined ('STDERR ' )) {
26+ fwrite (STDERR , 'Twig cache warming failed: ' . $ e ->getMessage () . PHP_EOL );
27+ }
28+
2529 return [];
2630 }
27-
28- return $ this ->twigCacheWarmer ->warmUp ($ cacheDir );
2931 }
3032
3133 public function isOptional (): bool
Original file line number Diff line number Diff line change @@ -34,14 +34,6 @@ public function getConfigTreeBuilder(): TreeBuilder
3434 ->end ()
3535 ->end ()
3636 ->end ()
37- ->arrayNode ('twig_cache_warmer ' )
38- ->addDefaultsIfNotSet ()
39- ->children ()
40- ->booleanNode ('enabled ' )
41- ->defaultFalse ()
42- ->end ()
43- ->end ()
44- ->end ()
4537 ->end ()
4638 ;
4739
You can’t perform that action at this time.
0 commit comments