-
Notifications
You must be signed in to change notification settings - Fork 5
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
Only add/remove from htaccess file when necessary #204
Conversation
Ensures that we only add/remove from the htaccess file when there's an option enabled that has associated htaccess rules, or when the htaccess file contains rules that should be removed because we've disabled all options that require htaccess rules. See wpsharks/comet-cache#641
@jaswsinc A review here when you get a chance. 😄 Thanks! |
@raamdev I reviewed the code for these changes. On this line I think the call to I also think that this block should always be run first, before we check if there is the need to add anything; i.e., remove what was there before we consider adding anything new. Otherwise it looks good to me. Other ThoughtsI'm a fan of optimization, and I like where you are going with this. However, in this particular case my feeling is that So while I don't see anything wrong with In this line we already bail if nothing needs to be written. Also, this only runs whenever you update your ZC options, right? So it's not an area of the codebase where optimization is really important. |
I disagree, and here's why: As of now, if a site owner does not have CDN Filters enabled there is no reason whatsoever to read or write to the And yet, as of now, here's what we do every time the site owner saves the plugin options even when there's nothing for us to do with the
That means we read the That was my reason for adding I have seen a handful of reports (including one from Pat) where there was an error message displayed on the Dashboard related to being unable to read/write to the |
That's a good point and I agree.
At some point it might be a good idea to add some more ways for this to wrong; i.e., increase the number of detailed exceptions that we throw until we can pinpoint more specifically what the problem is. |
@jaswsinc I added a few TODOs in f887948 so that we can revisit improving error reporting detail in the Htaccess Utils; I agree we need to do better there. |
See wpsharks/comet-cache#641
Quoting @raamdev from wpsharks/comet-cache#641 (comment):