Skip to content

Commit 4290999

Browse files
bug #51969 [FrameworkBundle] Fix calling Kernel::warmUp() when running cache:warmup (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Fix calling `Kernel::warmUp()` when running `cache:warmup` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT Maps to https://github.com/symfony/symfony/blob/e86d26abd07187d5ec5b2d780cfd1d872d57fe2a/src/Symfony/Component/HttpKernel/Kernel.php#L581-L587 Commits ------- f10c2cc [FrameworkBundle] Fix calling Kernel::warmUp() when running cache:warmup
2 parents 20ea2ae + f10c2cc commit 4290999

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Console\Style\SymfonyStyle;
1919
use Symfony\Component\DependencyInjection\Dumper\Preloader;
2020
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
21+
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
2122

2223
/**
2324
* Warmup the cache.
@@ -73,8 +74,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7374
if (!$input->getOption('no-optional-warmers')) {
7475
$this->cacheWarmer->enableOptionalWarmers();
7576
}
77+
$cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
7678

77-
$preload = $this->cacheWarmer->warmUp($cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'));
79+
if ($kernel instanceof WarmableInterface) {
80+
$kernel->warmUp($cacheDir);
81+
}
82+
83+
$preload = $this->cacheWarmer->warmUp($cacheDir);
7884

7985
if ($preload && file_exists($preloadFile = $cacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
8086
Preloader::append($preloadFile, $preload);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy