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

unlink calls should not be silenced with the @ operator #557

Open
andyexeter opened this issue Sep 16, 2022 · 2 comments
Open

unlink calls should not be silenced with the @ operator #557

andyexeter opened this issue Sep 16, 2022 · 2 comments

Comments

@andyexeter
Copy link

We were seeing issues with page cache (Disk: Enhanced) method not being cleared via the WP CLI with:

wp w3-total-cache flush all

After some debugging, I discovered this was because the page cache files were created by the web server user apache, and we were running the command as a different user which didn't have permission to delete the files.

However, the plugin does not report this - it comes back with the following message:

Success: Everything flushed successfully.

This is incorrect, because the code to clear the cache uses @ to silence errors when calling unlink.

I believe the plugin should either remove the @ operator, or check whether the current user has permission to delete the cache files and display a warning/error if not.

@maxicus
Copy link
Contributor

maxicus commented Sep 16, 2022

All silencers are there by intent.
unlinks may try to remove already removed file by other thread 1ms ago.
Removing will cause more harm for runtime operation than profit.

Also any deeper checks in that critical place will affect performance.
No simple solution here, while complain makes sense of course.

@andyexeter
Copy link
Author

andyexeter commented Sep 16, 2022

Thanks for the response. I understand the concerns.

How about checking the file owner / permissions of just the first file to be removed and if it differs from the current user displaying a warning instead of / as well as the success message?

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

No branches or pull requests

2 participants