composer-drupal-lenient icon indicating copy to clipboard operation
composer-drupal-lenient copied to clipboard

Add service provider, try to influence Drupal runtime parsing of core_version_requirement

Open mglaman opened this issue 2 years ago • 7 comments

mglaman avatar May 04 '23 13:05 mglaman

Folks who need this might want to try https://www.drupal.org/project/backward_compatibility

weitzman avatar Aug 10 '23 14:08 weitzman

Huh, so this is the magic.

/**
 * Implements hook_system_info_alter().
 */
function backward_compatibility_system_info_alter(&$info, Extension $file, $type) {
  $info['core_incompatible'] = FALSE;
}

Ah but it's invoked within the ExtensionList which is impossible to decorate. https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Core/Extension/ExtensionList.php#L322

And it's a bit risky (maybe) to decorate the module handler and manually inject our own hook.

mglaman avatar Dec 07 '23 22:12 mglaman

Another way would be to do a drush :) And add system_system_info_alter() in a file and include that file via composer. It does something similar with a log hook I think.

alexpott avatar Jul 10 '24 11:07 alexpott

FWIW this is something that hopefully hooks as PHP Attributes will allow us to solve nicely.

alexpott avatar Jul 10 '24 11:07 alexpott

Until (or if) this becomes possible, perhaps we could link to https://www.drupal.org/project/backward_compatibility in the README, since composer require and drush install go hand in hand?

gitressa avatar Nov 21 '24 14:11 gitressa

Drupal now uses OOP hooks. So I think this can be done now for 11.x!

mglaman avatar Nov 23 '24 02:11 mglaman

Fantastic! It would be awesome if all that's needed to bypass version constraints for both Composer (download) and Drush/GUI (install) is Drupal Lenient Composer Plugin.

gitressa avatar Nov 23 '24 11:11 gitressa