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

[5.6] Fix clearing the cache without a cache directory #23538

Merged
merged 3 commits into from Mar 14, 2018

Conversation

Projects
None yet
2 participants
@Jalle19
Contributor

Jalle19 commented Mar 14, 2018

Problem

As mentioned in
489c9f9, if storage_path('framework/cache') doesn't exist, php artisan cache:clear fails with the following error:

$ php artisan cache:clear -vvv

In Finder.php line 543:
                                                                        
  [InvalidArgumentException]                                            
  The "/vagrant/api/storage/framework/cache" directory does not exist.  

This happens regardless of the cache driver used, including array.

Solution

Practically all cache drivers except file work just fine without the framework/cache directory, so it's common to have deployments where said directory doesn't exist. Clearing the cache should still work, especially since an array or redis cache should have nothing to do with the filesystem.

I've added appropriate tests and took the liberty to clean the whole test case up a bit.

@Jalle19 Jalle19 changed the title from Fix clearing the cache without a cache directory to [5.6] Fix clearing the cache without a cache directory Mar 14, 2018

Jalle19 added some commits Mar 14, 2018

Fix running cache:clear when the framework/cache storage directory do…
…esn't exist

The only cache driver that needs this directory is the file driver, so it's reasonable to expect that customized deployments don't have it. Clearing e.g. a Redis cache should not touch the filesystem at all.

@taylorotwell taylorotwell merged commit 3737c01 into laravel:5.6 Mar 14, 2018

2 checks passed

continuous-integration/styleci/pr The StyleCI analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Jalle19

This comment has been minimized.

Contributor

Jalle19 commented Mar 14, 2018

@taylorotwell you want me to do a backport to the 5.5 branch since this was AFAICT introduced in 5.5.6?

@Jalle19 Jalle19 deleted the Jalle19:fix-clear-cache-without-cache-directory branch Mar 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment