Skip to content

Commit 01fb162

Browse files
Merge branch '2.3' into 2.7
* 2.3: [Process] Enhance compatiblity with --enable-sigchild [Process] Always call proc_close [Validator] Updated Luxembourgish translations for 2.8 [FrameworkBundle] prevent cache:clear creating too long paths Conflicts: src/Symfony/Component/Process/Tests/ProcessTest.php src/Symfony/Component/Process/Tests/SigchildDisabledProcessTest.php src/Symfony/Component/Process/Tests/SigchildEnabledProcessTest.php src/Symfony/Component/Process/Tests/SimpleProcessTest.php src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf
2 parents bad346d + 3585c78 commit 01fb162

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Command/CacheClearCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ protected function configure()
5454
protected function execute(InputInterface $input, OutputInterface $output)
5555
{
5656
$realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
57-
$oldCacheDir = $realCacheDir.'_old';
57+
// the old cache dir name must not be longer than the real one to avoid exceeding
58+
// the maximum length of a directory or file path within it (esp. Windows MAX_PATH)
59+
$oldCacheDir = substr($realCacheDir, 0, -1).('~' === substr($realCacheDir, -1) ? '+' : '~');
5860
$filesystem = $this->getContainer()->get('filesystem');
5961

6062
if (!is_writable($realCacheDir)) {
@@ -75,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7577
// the warmup cache dir name must have the same length than the real one
7678
// to avoid the many problems in serialized resources files
7779
$realCacheDir = realpath($realCacheDir);
78-
$warmupDir = substr($realCacheDir, 0, -1).'_';
80+
$warmupDir = substr($realCacheDir, 0, -1).('_' === substr($realCacheDir, -1) ? '-' : '_');
7981

8082
if ($filesystem->exists($warmupDir)) {
8183
if ($output->isVerbose()) {
@@ -114,8 +116,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
114116
*/
115117
protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = true)
116118
{
117-
$this->getContainer()->get('filesystem')->remove($warmupDir);
118-
119119
// create a temporary kernel
120120
$realKernel = $this->getContainer()->get('kernel');
121121
$realKernelClass = get_class($realKernel);

0 commit comments

Comments
 (0)