Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19fd27d

Browse filesBrowse files
[FrameworkBundle] Fix patching refs to the tmp warmup dir in files generated by optional cache warmers
1 parent 02db9c2 commit 19fd27d
Copy full SHA for 19fd27d

File tree

1 file changed

+10
-10
lines changed
Filter options

1 file changed

+10
-10
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
146146
}
147147
$this->warmupOptionals($useBuildDir ? $realCacheDir : $warmupDir, $warmupDir, $io);
148148
}
149+
150+
// fix references to cached files with the real cache directory name
151+
$search = [$warmupDir, str_replace('/', '\\/', $warmupDir), str_replace('\\', '\\\\', $warmupDir)];
152+
$replace = str_replace('\\', '/', $realBuildDir);
153+
foreach (Finder::create()->files()->in($warmupDir) as $file) {
154+
$content = str_replace($search, $replace, file_get_contents($file), $count);
155+
if ($count) {
156+
file_put_contents($file, $content);
157+
}
158+
}
149159
}
150160

151161
if (!$fs->exists($warmupDir.'/'.$containerDir)) {
@@ -227,16 +237,6 @@ private function warmup(string $warmupDir, string $realBuildDir): void
227237
throw new \LogicException('Calling "cache:clear" with a kernel that does not implement "Symfony\Component\HttpKernel\RebootableInterface" is not supported.');
228238
}
229239
$kernel->reboot($warmupDir);
230-
231-
// fix references to cached files with the real cache directory name
232-
$search = [$warmupDir, str_replace('\\', '\\\\', $warmupDir)];
233-
$replace = str_replace('\\', '/', $realBuildDir);
234-
foreach (Finder::create()->files()->in($warmupDir) as $file) {
235-
$content = str_replace($search, $replace, file_get_contents($file), $count);
236-
if ($count) {
237-
file_put_contents($file, $content);
238-
}
239-
}
240240
}
241241

242242
private function warmupOptionals(string $cacheDir, string $warmupDir, SymfonyStyle $io): void

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.