// create a temporary kernel
$kernel =
$this->
getApplication()->
getKernel();
if (!
$kernel instanceof RebootableInterface
) { throw new \
LogicException('Calling "cache:clear" with a kernel that does not implement "Symfony\Component\HttpKernel\RebootableInterface" is not supported.'
);
} $kernel->
reboot($warmupDir);
// fix references to cached files with the real cache directory name
$search =
[$warmupDir,
str_replace('\\', '\\\\',
$warmupDir)];
$replace =
str_replace('\\', '/',
$realBuildDir);
foreach (Finder::
create()->
files()->
in($warmupDir) as $file) { $content =
str_replace($search,
$replace,
file_get_contents($file),
$count);
if ($count) { file_put_contents($file,
$content);
} } } private function warmupOptionals(string
$cacheDir, string
$warmupDir, SymfonyStyle
$io): void
{ $kernel =
$this->
getApplication()->
getKernel();
$warmer =
$kernel->
getContainer()->
get('cache_warmer'
);