Problem/Motivation
#1577902: [META] Remove all usages of drupal_static() & drupal_static_reset() wants us to get rid of drupal_static().
#3015538: [META] Deprecate contents of common.inc wants us to deprecate functions in common.inc.
Thus here we feet two birds with one seed.
Proposed resolution
Move the functionality of drupal_get_updaters() into a static method on Drupal\Core\Updater\Updater. Let's call it getUpdaterRegistry().
Instead of using drupal_static() to cache in memory, we'll add a static property to Drupal\Core\Updater\Updater.
Deprecate drupal_get_updaters() in favor of Updater::getUpdaterRegistry().
Remaining tasks
- Feedback from #25
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | 3036010-35.patch | 10.76 KB | kim.pepper |
Issue fork drupal-3036010
Show commands
Start 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:
- 3036010-updaters
changes, plain diff MR !844
Comments
Comment #2
mile23Let's try a patch.
Comment #4
andypostLooking at usage I started to think that better to refactor it out of hooks at all. It looks more like event needed here.
On other hand in a light of composer this subsystem is very debatable
Comment #5
mile23Comment #6
mile23Reroll after #3000057: Deprecate drupal_set_time_limit() and file_upload_max_size() and move to Environment component, fixed failing tests, removed usages from docs.
I think a lot of this will be refactored for #2367319: Implement automatic background updates for highly critical security issues and similar issues.
Comment #7
mile23Comment #9
claudiu.cristeaNeeds to increment the Drupal version to 8.8.0.
This should be done also in CR(oh, no CR).Comment #10
mile23Comment #11
claudiu.cristeaWhat if a 3rd party code is doing this?
The current code allows resetting the memory cache but the patch has removed that ability. So, we need a reset cache mechanism and also deprecate the usage of
drupal_static_reset('drupal_get_updaters').Fixed the above. Also moved to 8.8.x and added CR.
Comment #14
hardik_patel_12 commentedRe-rolling against 9.1.x-dev.
Comment #16
hardik_patel_12 commentedComment #17
hardik_patel_12 commentedDrupal 9 was released, so we need to update the deprecation messages.
Comment #18
naresh_bavaskarComment #19
andypostProper re-roll (messages fixed) and clean-up
Also improved test
- module should test that data returned from old method
- no reason to split into 2 methods as both coupled and core installs twice for no reason
EDIT
Removed to make sure that static does not affect
Comment #22
longwaveNeeds reroll and deprecated versions updating.
Comment #24
claudiu.cristea@expectedDeprecationannotation into assertions$this->expectDeprecation().Comment #25
longwaveShould we just deprecate
resetRegistryCache()as well, there seems little point in keeping it. No uses ofdrupal_get_updatersin contrib, let alone the static: http://grep.xnddx.ru/search?text=drupal_get_updaters&filename=I'm not even sure I see the point in hook_updater_info, the only implementation is in system.module, but that's a wider issue - do we even really support updating anything else?
Comment #26
daffie commentedThe remark from @longwave in #25 still needs to be addressed.
The patch looks good to me!.
Comment #27
dhirendra.mishra commentedI have manually re-rolled it against 9.3.x
Comment #28
sokru commentedPatch on #27 failed to apply, so another try with reroll.
Comment #30
vsujeetkumar commentedRe-roll patch #27 is not appropriate, We missed some previous fixed changes according to #24. Please have a look.
Uploaded the updated patch for 9.3.x.
Comment #31
daffie commentedThe remark from @longwave in #25 still needs to be addressed.
Comment #35
kim.pepperReroll for 10.1.x.
Comment #36
kim.pepperComment #39
nicxvan commentedPretty sure this can be closed as outdated.
This function was deprecated outright.
The comment in 25 confused me until I realized it was just about deprecating the newly introduced static.
Comment #40
nicxvan commentedCompared the patches with the current state to confirm the deprecation covered everything in this.
The only thing this does that the main deprecation issue doesn't is deprecating calling drupal_static_reset for the function, but since the function is deprecated that seems fine to me.
Took a look at patches to apply credit as well since closed issues receive credit now.
I'm glad MRs are the primary way to review code, even with inter diffs patches are harder without the ui.
Thanks everyone for working on this!