Needs work
Project:
Drupal core
Version:
main
Component:
extension system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2023 at 23:55 UTC
Updated:
26 Dec 2023 at 21:22 UTC
Jump to comment: Most recent
drupal_check_module() is procedural code that relies on a number of external services. We should convert this to a service to make it more testable and maintainable.
Deprecate drupal_check_module() and replace with \Drupal\Core\Extension\RequirementsChecker::checkModuleRequirements()
drupal_check_module() is deprecated and replaced with \Drupal\Core\Extension\RequirementsChecker::checkModuleRequirements()
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:
Comments
Comment #3
kim.pepperComment #4
smustgrave commentedSearched for drupal_check_module and the 1 instance has been replaced. CR is there. Think this is good.
Comment #5
catchI'm not sure how useful this is as an API - what about moving the logic to a protected method on the form itself with no replacement? Does any contrib module call this function?
Comment #6
andypost4 usages in contrib http://codcontrib.hank.vps-private.net/search?text=drupal_check_module&f...
Comment #7
kim.pepperThere is also very similar/duplicated code for checking run-time requirements in
SystemManager::checkRequirements()https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/syste...Comment #8
catchThe page attachments examples from http://codcontrib.hank.vps-private.net/search?text=drupal_check_module&f... look like a bad idea, those modules could directly check their own requirements rather than jump through hoops. mmu is a reasonable example though because it's re-implementing the modules page, but then that's only one or two usages.
The ::getMaxSeverity() method on SystemManager looks identical to the one added here, so we could maybe call that from the form, or move the other helpers into SystemManager? But we definitely shouldn't duplicate that method, so marking needs work.
Comment #9
kim.pepperHmm. System manager looks like it deals runtime requirements but also with blocks of Menu Links??
Maybe we should expand this to move the runtime requirements checks from SystemManager to the new RequirementsChecker instead?
\Drupal\system\SystemManager::listRequirements()actually callsdrupal_load_updates()which depends onModuleExtensionListas well.Comment #10
kim.pepperChecking install and runtime requirements seem to be very different. Perhaps we should just move
getMaxSeverity()to a utility class instead.Comment #11
kim.pepperBack to needs review to see if you like this approach.
Comment #12
andypostLeft a review
Comment #13
kim.pepperI've made changes over at #2909472: Add value objects to represent the return of hook_requirements