Skip to content

Commit 7aa625b

Browse files
[HttpKernel] Enable optional cache-warmers when cache-dir != build-dir
1 parent bafe768 commit 7aa625b

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)