Problem/Motivation
Drupal::CORE_COMPATIBILITY is used in many places throughout to filter on core compatibility. Historically this has all corresponded to project branch and version names with the 8.x- prefix
Now that #2313917: Core version key in module's .info.yml doesn't respect core semantic versioning has been committed projects and specify that they are compatible with multiple versions of core using the core_version_requirement key in info.yml files
Proposed resolution
Completely remove this constant if possible, remove from any many uses as possible if not.
Remaining tasks
Identify all the issues for usages
- #3074993: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates
- #3016471: Make localization file download major version agnostic
It may be too late to deprecate this const in 8.x so it might have to wait until 9.x.
User interface changes
There are few places where it is used in message shown to the user. Determine if those message will change or the MAJOR_VERSION.x will be derived from different sources but the message will remain the same.
API changes
TBD
Data model changes
TBD
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 3085662-16.CORE_COMPATIBILITY.grep_.txt | 1.18 KB | dww |
Comments
Comment #2
tedbowComment #3
xjmComment #5
xjmWe won't deprecate this constant before 9.1.x.
Comment #6
andypostComment #7
webchickCould we at least make it 9.x then, in lieu of removing it? It would make it easier to write logic to do different things based on the major Drupal version.
Comment #8
berdir> Could we at least make it 9.x then, in lieu of removing it? It would make it easier to write logic to do different things based on the major Drupal version.
We've discussed in slack why it won't be renamed, that would break 8.x-x.y branches/releases on D9, it will either go away completely (at least as constant) or be renamed to something else, like LEGACY_COMPATIBILITY or something and remain 8.x forever. And that you should use Drupal::VERSION then instead to check the core version.
Just leaving this here to avoid confusion.
Comment #10
nedjoAs an interim measure it would be useful to add a comment to the
constdeclaration, perhaps referencing this issue. As is, the lineconst CORE_COMPATIBILITY = '8.x';in Drupal 9.x looks like an error.Comment #11
tedbow@nedjo I agree this needs comment. Created #3188689: Document why CORE_COMPATIBILITY is still 8.x in higher branches
Comment #16
dww+1 to removing this constant. To get the ball rolling, here are all 7 of the occurrences of 'CORE_COMPAT' in 10.1.x branch of core.
Comment #17
dwwSome initial thoughts on the above list...
This is fully wrong. 😉 IMHO, it should be using
\Drupal::MAJOR_VERSION(see #3134417: Add \Drupal::getMajorVersion()) not always printing '8.x' in this warning message.Also, shouldn't this message all be wrapped in
t()?This one is more tricky to undo.
Here we're using it to conditionally strip off any '8.x-' from a contrib module's version string. Perhaps we don't need a constant for this and can hard-code it in here.
This is the bulk of where we need to figure out what we want.
To be removed. 🤞
Same story as
ModuleDependencyMessageTrait... only using it to optionally strip '8.x-' from contrib versions.Perhaps we want to move some of this stripping logic into
core/lib/Drupal/Component/Versionsomewhere so we can put the hard-coded weirdness in one spot and re-use it anywhere we're converting contrib bespoke version strings for comparisons.Or maybe
core/lib/Drupal/Core/Extension/ExtensionVersion.phpwould be better for this... In fact, it's already got aCORE_PREFIXconst in there.Comment #18
dwwAdding #3093789: system_requirements() strips core compatibility in really fragile and dangerous way when comparing versions as related re: point 6 (and 3) above...
Comment #19
catchAdding a related issue for schema version.