From a14153a4fd6d3379d60a85af882dc8aefea08c7d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 15 Dec 2014 22:18:00 +0100 Subject: [PATCH] [FrameworkBundle] fix cache:clear command --- .../Command/CacheClearCommand.php | 18 +++++++++++++----- src/Symfony/Component/HttpKernel/Kernel.php | 6 +++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 1fea1b91a4e72..45c1bcf984971 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -74,6 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } else { // the warmup cache dir name must have the same length than the real one // to avoid the many problems in serialized resources files + $realCacheDir = realpath($realCacheDir); $warmupDir = substr($realCacheDir, 0, -1).'_'; if ($filesystem->exists($warmupDir)) { @@ -165,12 +166,14 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr */ protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir) { - $rootDir = $parent->getRootDir(); + $cacheDir = var_export($warmupDir, true); + $rootDir = var_export(realpath($parent->getRootDir()), true); + $logDir = var_export(realpath($parent->getLogDir()), true); // the temp kernel class name must have the same length than the real one // to avoid the many problems in serialized resources files $class = substr($parentClass, 0, -1).'_'; // the temp kernel name must be changed too - $name = substr($parent->getName(), 0, -1).'_'; + $name = var_export(substr($parent->getName(), 0, -1).'_', true); $code = << $this->rootDir, + 'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir, 'kernel.environment' => $this->environment, 'kernel.debug' => $this->debug, 'kernel.name' => $this->name, - 'kernel.cache_dir' => $this->getCacheDir(), - 'kernel.logs_dir' => $this->getLogDir(), + 'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(), + 'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(), 'kernel.bundles' => $bundles, 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(),