If you enable/disable the compress cached pages-setting (if you have cache enabled), Drupal will send the correct headers for that setting, but not refresh content to actually match this.
Steps to repeat:
- do a fresh cvs update
- make sure you have caching enabled (I currently have 'anonymous caching' and 5 min expiry/minimum lifetime enabled)
- visit your page, make sure you see a X-Drupal-Cache: HIT in your headers
- toggle the "compress cached pages" checkbox (in my case off to on)
- visit your page again
You should now either see plain content with a gzip flag or the opposite depending on which way you toggle the setting. Firefox will most likely complain about "Content Encoding Error".
While looking at modules/system/system.module each successful save _should_ run cache_clear_all(); but that apparently doesn't work or does nothing in my case.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 804328-compress-clear-cache-19.patch | 1.09 KB | David_Rothstein |
| #6 | 804328-compress-clear-cache.patch | 971 bytes | jcfiala |
| #3 | drupal-804328.patch | 992 bytes | jcfiala |
Comments
Comment #1
Anonymous (not verified) commentedNot sure if it matters, but I recall seeing something about theme specific overrides in post_save: I'm using the "seven" admin theme.
Comment #2
Anonymous (not verified) commentedI can still repeat this, and so will most likely other users. I consider this critical since drupal setups will stop to work for anonymous users.
Common settings (lifetime length isn't really relevant, only have it set):
* cache anonymous
* 5 min expiry lifetime
* 5 min minimum lifetime
* switch compress output flag
Here's anonymous curl output from from compressed initially set to checked: http://dpaste.com/hold/212325/
..and here's with the compress turned off: http://dpaste.com/hold/212323/
(spoiler: drupal still sends compressed data when the setting is switched to off since it serves from cache)
Comment #3
jcfiala commentedSo, here's a patch that does a cache_clear_all on 'cache_page' when the form is submitted.
Comment #4
alasda commentedApplied patch. Appears to work.
Comment #5
dries commentedI think we can write system_clear_page_cache().
There is only one page cache but multiple cached pages.
Comment #6
jcfiala commentedAlright, I've adjusted my patch based on what Dries said.
Comment #7
davidburnsapplied and tested. appears to work
Comment #8
dries commentedDoing some more research, I discovered that it might be best to re-purpose http://api.drupal.org/api/function/system_clear_cache_submit/7.
Comment #9
jcfiala commentedIs that a great idea?
A) It clears _every_ cache, instead of just the page cache, which is all that was originally requested.
B) It will announce to the user 'Caches Cleared' when the user wasn't trying to clear a cache.
Comment #10
dries commenteda) Given that this is a setting that you don't change every hour, it is OK to clear all caches.
b) That is not a great message to display.
We can introduce a new function per the original patch, but it would probably be great if we had consistent naming then. For example: system_clear_cache_submit and system_compress_cached_pages_submit or something?
Comment #11
webchickThat sounds like a "needs work".
Comment #12
jcfiala commented@Dries:
Just so I'm not rerolling minor changes in this patch which _functionally_ fixes the problem for the next week, if I rename the submit function to 'system_compress_cached_pages_submit', will that be sufficient to get this patch cleared?
And if not, what do we need to get this passed?
Comment #13
David_Rothstein commentedCalling drupal_flush_all_caches() has been known to bring down websites, so let's not do that here unless we absolutely need to, please. It should really only happen when someone presses the big red button that's specifically for that purpose.
#6 looks pretty good. If we are going to rename functions, I don't think system_compress_cached_pages_submit() makes sense since the submit handler is not tied to that form element (arguably it could be, but probably not worth the effort); the function doesn't do anything with compressed pages specifically, but rather all pages. I would just rename it system_clear_page_cache_submit() and be done with it. It clears the page cache and it's a submit handler - seems like an obvious name :) If we want to explain the reason we're calling it, just add a code comment.
Comment #14
catchNot critical - it's an edge case, and you can clear the cache manually.
Comment #15
Anonymous (not verified) commented@catch: Not sure I agree with you. While it may be an edge case, it's probably hard to figure out "what's not working" from a (logged in) user perspective since he/her won't even recognize something's not working until logged out. The least thing to be done is to actually explain to the user that this isn't something you want to toggle every now and then (which "performance"-options are very tempting to mess with for overall increased snappyness).
Comment #16
marcingy commentedChanging to major as per tag.
Comment #17
mustanggb commentedTag update
Comment #18
marcingy commented#6: 804328-compress-clear-cache.patch queued for re-testing.
Comment #19
David_Rothstein commentedChanged to system_clear_page_cache_submit() and added a code comment, as per #13.
Comment #20
marcingy commentedComment #21
dries commentedGood fix -- thanks for incorporating my feedback. Committed to CVS HEAD.