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

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

Merged

Conversation

Jalle19
Copy link
Contributor

@Jalle19 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 Fix clearing the cache without a cache directory [5.6] Fix clearing the cache without a cache directory Mar 14, 2018
…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.
@Jalle19 Jalle19 force-pushed the fix-clear-cache-without-cache-directory branch from 86f9d6f to 7c518d7 Compare March 14, 2018 12:47
@Jalle19 Jalle19 force-pushed the fix-clear-cache-without-cache-directory branch from 7c518d7 to 3737c01 Compare March 14, 2018 12:48
@taylorotwell taylorotwell merged commit 3737c01 into laravel:5.6 Mar 14, 2018
@Jalle19
Copy link
Contributor Author

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 fix-clear-cache-without-cache-directory branch March 14, 2018 13:19
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.

2 participants