8000 bug #12999 [FrameworkBundle] fix cache:clear command (nicolas-grekas) · symfony/symfony@aace2c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit aace2c6

Browse files
committed
bug #12999 [FrameworkBundle] fix cache:clear command (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- [FrameworkBundle] fix cache:clear command | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12893 | License | MIT | Doc PR | - Reading comment on #12893 stating that using absolute paths works around the pb, I tried using realpath(), and it works! Pending work on #12955 can be done quietly now. Commits ------- a14153a [FrameworkBundle] fix cache:clear command
2 parents ba9266f + a14153a commit aace2c6

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7474
} else {
7575
// the warmup cache dir name must have the same length than the real one
7676
// to avoid the many problems in serialized resources files
77+
$realCacheDir = realpath($realCacheDir);
7778
$warmupDir = substr($realCacheDir, 0, -1).'_';
7879

7980
if ($filesystem->exists($warmupDir)) {
@@ -165,12 +166,14 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
165166
*/
166167
protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
167168
{
168-
$rootDir = $parent->getRootDir();
169+
$cacheDir = var_export($warmupDir, true);
170+
$rootDir = var_export(realpath($parent->getRootDir()), true);
171+
$logDir = var_export(realpath($parent->getLogDir()), true);
169172
// the temp kernel class name must have the same length than the real one
170173
// to avoid the many problems in serialized resources files
171174
$class = substr($parentClass, 0, -1).'_';
172175
// the temp kernel name must be changed too
173-
$name = substr($parent->getName(), 0, -1).'_';
176+
$name = var_export(substr($parent->getName(), 0, -1).'_', true);
174177
$code = <<<EOF
175178
<?php
176179
@@ -180,17 +183,22 @@ class $class extends $parentClass
180183
{
181184
public function getCacheDir()
182185
{
183-
return '$warmupDir';
186+
return $cacheDir;
184187
}
185188
186189
public function getName()
187190
{
188-
return '$name';
191+
return $name;
189192
}
190193
191194
public function getRootDir()
192195
{
193 8000 -
return '$rootDir';
196+
return $rootDir;
197+
}
198+
199+
public function getLogDir()
200+
{
201+
return $logDir;
194202
}
195203
196204
protected function buildContainer()

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,12 @@ protected function getKernelParameters()
586586

587587
return array_merge(
588588
array(
589-
'kernel.root_dir' => $this->rootDir,
589+
'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir,
590590
'kernel.environment' => $this->environment,
591591
'kernel.debug' => $this->debug,
592592
'kernel.name' => $this->name,
593-
'kernel.cache_dir' => $this->getCacheDir(),
594-
'kernel.logs_dir' => $this->getLogDir(),
593+
'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(),
594+
'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(),
595595
'kernel.bundles' => $bundles,
596596
'kernel.charset' => $this->getCharset(),
597597
'kernel.container_class' => $this->getContainerClass(),

0 commit comments

Comments
 (0)
0