Using the "file" cache driver, my cache files are owned by the web server user (www-data) and not writable by me, but artisan cache:clear still says "Application cache cleared!", giving no indication that it actually failed.
The cache:clear command clears the applications services.json file, not the app/storage/cache directory. Check to see if that file is being deleted.
Jason, I'm pretty sure cache:clear deletes the app/storage/cache if
you're using the file driver.
Oh yeah, it does, I totally overlooked that first line. :wink: (Still waking up!)
However, the cache stores don't return a boolean for success or failure.
Eh, just going to close this for now. Don't see it as very critical as probably isn't totally worth the time to fix at the moment.
This just happened to me last night. I'm trying to figure out where in code does the cache actually delete the files from filesystem ... it seems like a simple thing to fix, if only I could locate the file xD
Found it, going to create a PR once fixed.
Found the issue, but don't know how to properly fix it because things need to be changed a little.
Let me take you step by step on this one:
The problem is when the Cache calls flush method on FileStore cache store. It then calls deleteDirectory method which just assumes that deleting files and directories from that directory went good. When in fact it didn't.
This line here just ignores output from delete method which in fact tries to delete a file and return false or true if it succedes or fails.
Possible solution:
Possible hiccup:
I have found a contract for Store where it says that flush() method should return void.
Maybe implementing this change would mean that other cache stores would need to implement boolean as a return value on flush method.
What do you think?
i'm having the same issue right now @davejamesmiller did you manage to solve the issue?
@jfelipeara Yeah I just fix the file permissions or delete the files manually, e.g. using sudo.
These days I use php-fpm instead of mod_php though, so I don't have this issue (PHP runs under my user account instead of www-data).
@davejamesmiller Well I ran through the same problem and stumbled upon this issue through google. Tried the cache:clear with sudo and it worked like a charm. Issue verified for Laravel 5.3.
I just ran into this issue with 5.5.
I don't understand @taylorotwell's reasoning behind closing the issue. If a tool isn't doing what it says it does, then it really shouldn't return a success message. Seems pretty critical to me.
In 5.5. ran into the same issue. Even sudo didn't help. From what I see, 5.6 has the same issue.
Even though flush() now returns a boolean, it is not handled appropriately.
Most helpful comment
@jfelipeara Yeah I just fix the file permissions or delete the files manually, e.g. using
sudo.These days I use
php-fpminstead ofmod_phpthough, so I don't have this issue (PHP runs under my user account instead ofwww-data).