Skip to content

Commit db6ddb2

Browse files
bug symfony#57553 [HttpKernel] Enable optional cache-warmers when cache-dir != build-dir (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [HttpKernel] Enable optional cache-warmers when cache-dir != build-dir | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT We should be running optional cache warmers during kernel compilation when cache-dir != build-dir. This gives them an opportunity to run, which is missing right now. Commits ------- 7aa625b [HttpKernel] Enable optional cache-warmers when cache-dir != build-dir
2 parents 4bd613d + 7aa625b commit db6ddb2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,17 @@ protected function initializeContainer()
539539
touch($oldContainerDir.'.legacy');
540540
}
541541

542-
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir) : [];
542+
$cacheDir = $this->container->getParameter('kernel.cache_dir');
543+
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($cacheDir, $buildDir) : [];
543544

544545
if ($this->container->has('cache_warmer')) {
545-
$preload = array_merge($preload, (array) $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir));
546+
$cacheWarmer = $this->container->get('cache_warmer');
547+
548+
if ($cacheDir !== $buildDir) {
549+
$cacheWarmer->enableOptionalWarmers();
550+
}
551+
552+
$preload = array_merge($preload, (array) $cacheWarmer->warmUp($cacheDir, $buildDir));
546553
}
547554

548555
if ($preload && file_exists($preloadFile = $buildDir.'/'.$class.'.preload.php')) {

0 commit comments

Comments
 (0)