Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrameworkBundle] Bugfixes in buildDir in the CacheClear command #38548

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Oct 13, 2020

Q A
Branch? 5.x
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #38547
License MIT
Doc PR n/a

Making sure one can clear cache with and without a buildDir

@nicolas-grekas nicolas-grekas added this to the 5.2 milestone Oct 13, 2020
@@ -141,7 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if (!$fs->exists($warmupDir.'/'.$containerDir)) {
$fs->rename($realCacheDir.'/'.$containerDir, $warmupDir.'/'.$containerDir);
$fs->rename($realBuildDir.'/'.$containerDir, $warmupDir.'/'.$containerDir);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a separate buildDir and warming the cache. The container will never be located in $warmupDir. It will always be in $readBuildDir.

If we dont have a separate buildDir. Then $readBuildDir === $readCacheDir`

} else {
$fs->remove($realCacheDir);

if ($oldBuildDir !== $oldCacheDir) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not try to rename or remove $realCacheDir again.


if ($realCacheDir !== $realBuildDir) {
// Copy the content of the warmed cache in the build dir
$fs->mirror($realCacheDir, $realBuildDir);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just a typo: copy() is for files, mirror() is for directories.

@nicolas-grekas
Copy link
Member

Funny, you submitted at the same time as #38549 :)
Could you compare both implementations and borrow the best of them, please?

@nicolas-grekas nicolas-grekas changed the title [FrameworkBundle] Bugfixes in buildDir in the CahceClear command [FrameworkBundle] Bugfixes in buildDir in the CacheClear command Oct 13, 2020
@nicolas-grekas
Copy link
Member

Thank you @Nyholm.

@nicolas-grekas nicolas-grekas merged commit 8fa0573 into symfony:5.x Oct 13, 2020
@Nyholm
Copy link
Member Author

Nyholm commented Oct 13, 2020

Thank you @BoShurik and @nicolas-grekas

@Nyholm Nyholm deleted the frameworkbundle-cache-clear branch October 13, 2020 18:12
@fabpot fabpot mentioned this pull request Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception while clearing cache in 5.2.0-BETA1
5 participants