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

[3.2] Fix edge-case cache:clear fails #6747

Merged
merged 1 commit into from
Jun 8, 2017
Merged

[3.2] Fix edge-case cache:clear fails #6747

merged 1 commit into from
Jun 8, 2017

Conversation

GwendolenLynch
Copy link
Contributor

DISCLAIMER: Team O.C.D. triggers within!

Problem

Under edge-case circumstances running ./app/nut cache:clear would produce the following exception:

[UnexpectedValueException]
RecursiveDirectoryIterator::__construct(app/cache/development/data): 
failed to open dir: No such file or directory

Situation

The app/cache/ _project _ directory will usually contain a .version file, that let's Bolt quickly check (on boot()) if the running version matches last boot … if not, it will perform some additional work … such as clearing the cache.

Problem being that our implementation goes on to delete a bunch of other directories, one of which will contain Doctrine's cache directory.

Doctrine's cache only checks for the existence of, and creates if missing, its target directory on construct. This is sensible behaviour on the cache's part as its focus is pure speed!

Did two people on the core team have a huge cache refactor on their TODOs … Yes, yes we do!

Approach

Recreate Doctrine cache's base path as we nuke it after construction.

@CarsonF The chosen approach might slightly piss you off, and sorry but unless you have simple short term solutions, we're going to have to live with it. Our local adaptor (and Flysystem's for that matter) ignores the passed in Config object settings, so currently using it to recreate Doctrine's directory does it with restrictive permissions

… and I am not personally comfortable loosening what is passed into the Local constructor, as while some people who can't ACL need 0770 or even 777 the cache directory contains sensitive data, and those of us that give the slightest 💩 about server/system/application security are not going to agree to it as a default with the current cache mount.

@GwendolenLynch GwendolenLynch added this to the Bolt 3.2 - Feature release milestone Jun 8, 2017
Copy link
Member

@bobdenotter bobdenotter left a comment

Choose a reason for hiding this comment

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

Works like a charm for me! 🐵

@bobdenotter bobdenotter merged commit 568959e into bolt:release/3.2 Jun 8, 2017
@GwendolenLynch GwendolenLynch deleted the hotfix/race-around-the-cache branch June 8, 2017 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants