Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
4 May 2023 at 23:48 UTC
Updated:
2 Aug 2023 at 09:04 UTC
Jump to comment: Most recent
Splitting off a child issue from #3014752: Convert drupal_flush_all_caches() function to a Cache Clearer service where @alexpott suggested in comment #83:
I think this issue could do with coming in 2 parts. One that deals with the new CSS / JS query string service and converting usages of _drupal_flush_css_js() and anything that accesses the 'system.css_js_query_string' state directly. And another that deals with drupal_flush_all_caches() and drupal_rebuild().
This issue is for the first part of that.
_drupal_flush_css_js() AssetQueryString cache serviceStart within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kim.pepperWorking on this
Comment #3
andypostSounds related, intrigued)
Comment #5
kim.pepperComment #6
kim.pepperQueryStringseems a bit generic. How aboutAssetQueryString?Comment #7
kim.pepperComment #8
andypostAdded few comments, overall looks great
- strict types - needs removal
- BC for removed state property may fire in child classes, could need
DeprecatedServicePropertyTrait- default value from state is now '0' so extra processing of NULL is gone and I think it's fine
Comment #10
kim.pepperComment #11
andypostI find it ready but not sure allowed in current state https://www.drupal.org/about/core/policies/core-change-policies/allowed-...
Comment #12
andypostUsage in contrib http://codcontrib.hank.vps-private.net/search?text=_drupal_flush_css_js%...
Comment #13
kim.pepperFunny to see that what we consider a private function (because of the leading underscore) gets used like a public function anyway. 😆
Comment #16
larowlanWim's comment appears unresolved
Comment #17
kim.pepperResolved thread.
Comment #18
smustgrave commentedSeems all threads have been resolved but change record still needs work.
Example of before/after is always useful.
Comment #19
kim.pepperUpdated the CR and added before and after. This is meant to be an internal method, so doubtful anyone would be calling this directly.
Comment #20
smustgrave commentedCR looks good!
Comment #21
longwaveclaro_page_attachments_alter()still calls state directly, this needs converting to use the service:Do we have a way of deprecating state variables? How can we detect and communicate this to contrib? A contrib search shows quite a few uses of state directly reading
system.css_js_query_string, but if someone swaps the service to do something else, this won't work any more.Comment #22
kim.pepperFixed
claro_page_attachments_alter().We could check the state key when setting and getting, but that would be triggered by AssetQueryString which is using the same state key.
However, people shouldn't be bypassing
_drupal_flush_css_js()and accessing state directly. It's like querying the database directly.Comment #23
longwaveThe issue isn't with
_drupal_flush_css_js(), modules mostly want to read the value - we never provided an API for that, reading state directly was the only way.See http://grep.xnddx.ru/search?text=css_js_query_string&filename= for lots of examples.
Comment #24
kim.pepperOk. An alternative approach is we switch the state key to something new in
AssetQueryString, then check for the old one in\Drupal\Core\State\State::get()/::set()and throw a deprecation message?Comment #25
kim.pepperCapturing the slack conversation with @catch and @ongwave. We will:
Comment #26
longwaveI think we only need to get/set the new key; the deprecation handling should take care of that transparently to the caller.
Comment #27
kim.pepperMakes more sense. I've used the 'replacement' to swap out the deprecated key in get/set methods.
Comment #28
andypostAdded suggestion for test docs, otherwise RTBC++
Comment #29
smustgrave commentedAll threads appear to be resolved and CR has before/after examples.
Comment #30
catchOverall this looks great, but I think we need a post update to remove the old state entry?
Comment #31
kim.pepperAdded post-update hook.
Comment #32
kim.pepperJust a post update hook, so I think it's safe for me to put this back to RTBC.
Comment #33
penyaskitoLGTM if extra eyes are required.
Comment #35
longwaveCommitted and pushed b3e943e926 to 11.x (10.2.x). Thanks!
Also tweaked and published the change record.
Comment #36
longwaveI realised we forgot to add BC for the new argument here:
Will open a followup.
Comment #37
longwave#3375477: Add BC for asset.query_string service to DbUpdateController::__construct