Problem/Motivation

We would like to deprecate all legacy code in the file core/includes/module.inc. The function drupal_required_modules() is used only once in core/includes/install.inc and 5 usages in contrib http://grep.xnddx.ru/search?text=drupal_required_modules

Proposed resolution

Deprecate the function without replacement

Remaining tasks

review/commit

User interface changes

None

API changes

The function drupal_required_modules() will be deprecated.

Comments

andypost created an issue. See original summary.

andypost’s picture

Issue summary: View changes
andypost’s picture

Status: Active » Needs review
StatusFileSize
new3.85 KB
voleger’s picture

Status: Needs review » Needs work

typo, needs work

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.3 KB
new3.85 KB

Fixed typos

voleger’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Single function usage was replaced with appropriate code. A deprecation message was added and is correct. The deprecation test is implemented.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Tests are failing.

voleger’s picture

+++ b/core/includes/install.inc
@@ -1138,9 +1140,16 @@ function install_profile_info($profile, $langcode = 'en') {
-    // drupal_required_modules() includes the current profile as a dependency.
-    // Remove that dependency, since a module cannot depend on itself.
-    $required = array_diff(drupal_required_modules(), [$profile]);
+    // Get a list of core's required modules.
+    $required = [];
+    $listing = new ExtensionDiscovery(\Drupal::root());
+    $files = $listing->scan('module');
+    foreach ($files as $name => $file) {
+      $info = $info_parser->parse($file->getPathname());
+      if (!empty($info) && !empty($info['required']) && $info['required']) {
+        $required[] = $name;
+      }
+    }

In scope of the foreach loop here, the $info variable has to be renamed to, let's say, $file_info variable

ravi.shankar’s picture

Status: Needs work » Needs review
StatusFileSize
new3.87 KB
new726 bytes

Made changes as per comment #8, Let's see if the test bot is happy or not.

By mistake added the wrong name of the patch...

andypost’s picture

StatusFileSize
new3.84 KB
new1.35 KB

Thank you, polished with "parser" and "parsed"

voleger’s picture

Status: Needs review » Reviewed & tested by the community

Yes, that was the issue. Looks good now.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Looks good now, but needs a reroll.

voleger’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new3.79 KB

Patch #10 applied cleanly over 9.4.x
Attaching the rerolled patch for 10.0.x

andypost’s picture

I think for 10.0.x we need follow-up to remove the function when the issue commited

andypost’s picture

Issue tags: -Needs reroll

  • catch committed e5c38d9 on 10.0.x
    Issue #3262805 by andypost, ravi.shankar, voleger: Deprecate...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed e5c38d9 and pushed to 10.0.x. Thanks!

andypost’s picture

Filed follow-up #3262931: Remove drupal_required_modules() and mentions

It still needs commit to 9.4.x

voleger’s picture

Status: Fixed » Reviewed & tested by the community

Yes, the patch #10 was not applied for 9.4.x branch

xjm’s picture

I added a 9.4.x test run.

voleger’s picture

#10 3262805-10.patch has to go into 9.4.x
#13 3262805-13-10.0.x.patch already committed into 10.0.x

  • catch committed a87084f on 9.4.x
    Issue #3262805 by andypost, ravi.shankar, voleger, catch: Deprecate...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Sorry folks of course this needs to go into 9.4.x too, committed the patch from #10 and pushed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.