Skip to content

Commit 8eadd68

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

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,16 @@ 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+
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($buildDir, $buildDir) : [];
543543

544544
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));
545+
$cacheWarmer = $this->container->get('cache_warmer');
546+
547+
if ($this->container->getParameter('kernel.cache_dir') !== $buildDir) {
548+
$cacheWarmer->enableOptionalWarmers();
549+
}
550+
551+
$preload = array_merge($preload, (array) $cacheWarmer->warmUp($buildDir, $buildDir));
546552
}
547553

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

0 commit comments

Comments
 (0)