Problem/Motivation
We have made several class final and internal lately for the Update module.
- \Drupal\update\ProjectSecurityData
- \Drupal\update\ProjectSecurityRequirement
- \Drupal\update\ModuleVersion
These methods have to do with internal logic and should not be called directly and should not be extended
We should also do this with \Drupal\update\ProjectCoreCompatibility. This class has not be backported to 8.8.x so I think if we do it now it should be fine.
Nobody should extend this or call it directly.
If some wants the compatiblity message they can call update_calculate_project_data()
making this class final has no effect on this. Because update_calculate_project_data()
is existing global function we can't do anything to prevent from being an API.
I don't think we should consider our core compatibility messages an API but If a site wants a different message they can implement hook_update_status_alter()
and unset core's message and make their own. Again because update_calculate_project_data()
is existing global function we can't really prevent that. Our message should not be extendable besides translation. So there is no need for this class to be called directly or extended.
Proposed resolution
Make it final and internal
Remaining tasks
User interface changes
None
API changes
The class will be final and internal
Data model changes
none
Release notes snippet
none, it wasn't in 8.8.x
Comment | File | Size | Author |
---|---|---|---|
#12 | 3116198.10_12.interdiff.txt | 474 bytes | dww |
#12 | 3116198-12.8_8_x.patch | 615 bytes | dww |
#12 | 3116198-12.8_9_x.patch | 617 bytes | dww |
Comments
Comment #2
tedbowpatch
Comment #3
tedbowComment #4
tedbowComment #5
dwwI guess I'm +1 to this change. However, this bit from the summary seems a little unfortunate:
I thought we hated the procedural "API" (such as it is) for Update module. Seems like a wonky thing to recommend people do if they need this info. I know that's a whole bigger / different problem.
Certainly #3113992: The 'Update' page has no idea that some updates are incompatible can do what it needs without touching this class. So that's a good argument that this class really doesn't need to be called directly by anyone outside of update_calculate_project_data().
So, okay, I guess I convinced myself. Let's do this.
Comment #6
dwwUpon closer review:
This line of context is changing upstream, so this patch probably won't apply cleanly after #3102724: Improve usability of core compatibility ranges on available updates report lands. Not much we can do about it now, but I'd be in favor of postponing this on making sure that lands first so we don't derail anything...
This comment doesn't add anything beyond what @internal already says. I'm not sure what to do about that. I believe our standards (not sure they're documented) are to have a comment with @internal declarations. But saying, in effect: "this is internal and is internal and should not be called externally" seems pointless.
How about something like this for the comment:
(approx).
Thanks,
-Derek
Comment #7
tedbow@dww thanks for the feedback and suggestions.
re #5 I updated the summary. I just meant to say there ways to change and retrieve the message that we can't really prevent given how things work now. No need to make yet another API point
re #6
Comment #8
tedbowComment #9
tim.plunkettLooks great
Comment #10
tedbowHere is patch for 8.9.x.
They are different because #3102724: Improve usability of core compatibility ranges on available updates report hasn't been committed yet to 8.8.x because it needs #3074993: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates
#3102724 changed the class comment so it makes the diff different(I gotta remember fight harder to keep scope small 😜)
Comment #11
dwwHate to do this for ridiculous nits, but I suspect the core committers will notice, so we might as well fix it, first:
Improper indenting (extra space) on the 2nd line of the comment.
Otherwise, all +1 here.
Thanks!
-Derek
Comment #12
dwwFixed #11.
My preference would be for #3102724: Improve usability of core compatibility ranges on available updates report to land in 8.8.x first, then the 8.9.x patch here should cleanly apply.
Otherwise, here's an 8.8.x-specific patch if needed.
Comment #13
tedbow@dww thanks for catching that
Comment #17
Gábor HojtsyI agree it makes sense to be more limited in terms of our API surface with stuff we do not intend people to use. Good call.