Skip to content

Commit 9ec35d2

Browse files
committed
fix: remove dependency config for twig warmer, enable it by default
1 parent e8b1bfe commit 9ec35d2

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

frosh-tools-schema.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@
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

src/Components/Twig/TwigCacheKernelWarmer.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
class 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

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)