- πΊπΈUnited States 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.
- πΊπΈUnited States dww
Some initial thoughts on the above list...
-
core/includes/update.inc: $ret[$module]['warning'] = '<em>' . $module . '</em> module cannot be updated. It contains an update numbered as ' . \Drupal::CORE_MINIMUM_SCHEMA_VERSION . ' which is reserved for the earliest installation of a module in Drupal ' . \Drupal::CORE_COMPATIBILITY . ', before any updates. In order to update <em>' . $module . '</em> module, you will need to install a version of the module with valid updates.';
This is fully wrong. π IMHO, it should be using
\Drupal::MAJOR_VERSION
(see π Add \Drupal::getMajorVersion() Needs work ) not always printing '8.x' in this warning message.Also, shouldn't this message all be wrapped in
t()
? -
core/lib/Drupal/Core/Extension/Dependency.php: $this->constraint = new Constraint($this->constraintString, \Drupal::CORE_COMPATIBILITY);
This one is more tricky to undo.
-
core/lib/Drupal/Core/Extension/ModuleDependencyMessageTrait.php: $version = str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $modules[$dependency]->info['version'] ?? '');
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.
-
core/lib/Drupal/Component/Version/Constraint.php: * Normally this is set to \Drupal::CORE_COMPATIBILITY by the caller.
This is the bulk of where we need to figure out what we want.
-
core/lib/Drupal.php: const CORE_COMPATIBILITY = '8.x';
To be removed. π€
-
core/modules/system/system.install: $version = str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $required_file->info['version'] ?? '');
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/Version
somewhere 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.php
would be better for this... In fact, it's already got aCORE_PREFIX
const in there.
-
- πΊπΈUnited States dww
Adding #3093789: system_requirements() strips core compatibility in really fragile and dangerous way when comparing versions β as related re: point 6 (and 3) above...