Problem/Motivation
There's a config:
system.performance response.gzip
...which is defined in core/modules/system/config/schema/system.schema.yml and is mapped to the D6/7 variable page_compression e.g. in core/modules/system/migration_templates/d6_system_performance.yml
However, after the changes to page cache in #2368987: Move internal page caching to a module to avoid relying on config get on runtime it seems that response.gzip doesn't actually do anything any more.
In fact, it looks like consensus was reached in #28 of that issue that this should be removed:
catch and [Wim Leers] agreed that the best way forward was to simply remove the "Compress cached pages"/response.gzip
It seems that the changes committed didn't remove response.gzip though.
Proposed resolution
Remove response.gzip and remaining references to it e.g.
core/modules/page_cache/src/Tests/PageCacheTest.php:228: $config->set('response.gzip', 1);
core/modules/system/migration_templates/d6_system_performance.yml:17: 'response/gzip': page_compression
core/modules/page_cache/src/StackMiddleware/PageCache.php:184: * If page_compression is enabled, a gzipped version of the page is stored in
core/modules/system/config/schema/system.schema.yml:189: gzip:
core/modules/system/config/schema/system.schema.yml-190- type: boolean
core/modules/system/config/schema/system.schema.yml-191- label: 'Compress cached pages'
Remaining tasks
Review patch to remove response.gzip and remaining references to it.
User interface changes
None - the "Compress cached pages" option is already gone from the UI.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | remove_response_gzip-2775381-27.patch | 7.62 KB | mcdruid |
Comments
Comment #2
mcdruid commentedPatch to remove response.gzip and related code / comments.
I'm not 100% sure about removing the "Negotiate whether to use compression." section from StackMiddleware/PageCache.php but AFAICS the cached response's content will never be gzipped, so I'm fairly sure this code is redundant.
Comment #3
mcdruid commentedComment #4
wim leersThis is correct, per #2368987-28: Move internal page caching to a module to avoid relying on config get on runtime.
Comment #5
wim leersAlso, YAY! Less code! :D
Thanks, @mcdruid!
Comment #6
catchShouldn't this have an update to remove the key from installed configuration?
Comment #7
znerol commentedI'm a bit confused about the
PageCacheTest. We have assertions for theVaryresponse header and we test explicitly forCookie, Accept-Encoding. I'd expect that this assertion needs to be modified when throwing out gzip support. On the other hand, there are no functional changes. Maybe theAccept-Encodingbit comes from the web server?Comment #8
mcdruid commentedGood point - added.
I asked in IRC about the
addtogroup updates-8.2.xand xjm mentioned that there's quite a bit of inconsistency in core... e.g. should it be 8.2.x or 8.2.0? I've gone with the former, but open to suggestions.Comment #10
wim leers#6: good point! Sorry. Was too enthusiastic about deleting code :P
Comment #11
mcdruid commentedNot sure why the patch in #8 failed tests first time around; re-ran them and it passed this time.
Comment #13
mcdruid commentedNeeded a reroll. One reason was that a new update_hook_N has been added to system.install - and it looks like no
addtogroupcomments were included...For now, I've updated this issue's update hook including the comments, and will file a new issue for the addtogroup comments which are seemingly absent from system_update_8200.
Comment #14
naveenvalechaAdd the hook_post_update_NAME for the config changes so that we can also test it as well. https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...
Comment #15
wim leersRight, I'm afraid @naveenvalecha is right: this needs an upgrade path test. Fortunately it's fairly simple in this case. Good examples:
\Drupal\field\Tests\Update\EntityReferenceHandlerSettingUpdateTest,\Drupal\system\Tests\Update\FilterHtmlUpdateTest::testAllowedHtmlUpdate,\Drupal\rest\Tests\Update\RestExportAuthUpdateTest.Comment #17
mcdruid commentedPatch needed a re-roll (more hook_update_N's have been added to the system module in the meantime).
I've added an Update test which sets
response.gzip, runs updates and then checks that the config no longer exists... hoping I got the right idea there.I've not added a
hook_post_update_NAMEas I don't see what the purpose of that would be, but happy to look at that again if I'm missing something.Comment #19
mcdruid commentedRemoved
response.gzipfrom a D6 and D7 migration test, moved thehook_update_Nintoupdates-8.4.x(instead of 8.3.x), and removedresponsefrom config as well asresponse.gzipin that update hook... if I'm interpreting the test failures correctly, this is necessary as we're removing the wholeresponseconfig key from the schema.Comment #20
mcdruid commentedComment #22
mcdruid commentedRemoved another mapping of response/gzip for D7 migration.
Comment #23
mcdruid commentedHave a feeling removing
responseas well asresponse.gzipis probably not necessary; see whether tests will pass without.Comment #25
mcdruid commentedOk, so looks like perhaps it is necessary to remove
responsein the hook_update_N, unless I'm misunderstanding what's going on. Back to the patch in #22.Comment #26
mcdruid commentedComment #27
mcdruid commentedRe-roll of #22 (which is deliberate, #23 didn't pass tests without removing
responseentirely).The re-roll included removing the
addtogroup updates-8.4.xcomments per #2860096: Remove api doc groups for updates eg. updates-8.2.x-to-8.3.x.Comment #28
wim leersThanks!
Comment #29
catchCommitted/pushed to 8.4.x, thanks!
Comment #31
wim leersComment #32
wim leersSomething was forgotten here: #2892179: Follow-up for #2775381: clearing render cache in PerformanceForm::submitForm() is obsolete.