[FrameworkBundle][CacheWarmupCommand] Append files to preload
This commit is contained in:
parent
71b3912143
commit
a82c7ab4c0
@ -120,7 +120,7 @@ EOF
|
|||||||
$warmer->enableOnlyOptionalWarmers();
|
$warmer->enableOnlyOptionalWarmers();
|
||||||
$preload = (array) $warmer->warmUp($realCacheDir);
|
$preload = (array) $warmer->warmUp($realCacheDir);
|
||||||
|
|
||||||
if (file_exists($preloadFile = $realCacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
|
if ($preload && file_exists($preloadFile = $realCacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
|
||||||
Preloader::append($preloadFile, $preload);
|
Preloader::append($preloadFile, $preload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ EOF
|
|||||||
$warmer->enableOnlyOptionalWarmers();
|
$warmer->enableOnlyOptionalWarmers();
|
||||||
$preload = (array) $warmer->warmUp($warmupDir);
|
$preload = (array) $warmer->warmUp($warmupDir);
|
||||||
|
|
||||||
if (file_exists($preloadFile = $warmupDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
|
if ($preload && file_exists($preloadFile = $warmupDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
|
||||||
Preloader::append($preloadFile, $preload);
|
Preloader::append($preloadFile, $preload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
use Symfony\Component\DependencyInjection\Dumper\Preloader;
|
||||||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
|
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +78,11 @@ EOF
|
|||||||
$this->cacheWarmer->enableOptionalWarmers();
|
$this->cacheWarmer->enableOptionalWarmers();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cacheWarmer->warmUp($kernel->getContainer()->getParameter('kernel.cache_dir'));
|
$preload = $this->cacheWarmer->warmUp($cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'));
|
||||||
|
|
||||||
|
if ($preload && file_exists($preloadFile = $cacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
|
||||||
|
Preloader::append($preloadFile, $preload);
|
||||||
|
}
|
||||||
|
|
||||||
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
if ($this->container->has('cache_warmer')) {
|
if ($this->container->has('cache_warmer')) {
|
||||||
$preload = (array) $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'));
|
$preload = (array) $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'));
|
||||||
|
|
||||||
if (method_exists(Preloader::class, 'append') && file_exists($preloadFile = $cacheDir.'/'.$class.'.preload.php')) {
|
if ($preload && method_exists(Preloader::class, 'append') && file_exists($preloadFile = $cacheDir.'/'.$class.'.preload.php')) {
|
||||||
Preloader::append($preloadFile, $preload);
|
Preloader::append($preloadFile, $preload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user