ExtensionDiscovery::scan() is huge, which makes it very hard to override, and hard to maintain.

We can significantly reduce its size by moving out the extension filtering and sorting to helper methods.

Beta evaluation: This is a minimum-disruption internal refactoring with the goal to reduce ExtensionDiscovery fragility, and make it easier for ExtensionDiscovery to be extended and modified (which is something that the composer_manager module needs, for example).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

Status: Active » Needs review
FileSize
6.25 KB

Initial patch.

dawehner’s picture

+++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
@@ -277,6 +237,91 @@ public function setProfileDirectories(array $paths = NULL) {
+  protected function filter(array $all_files) {

Given its documentation we could find a better name: filterByCurrentInstallationProfile or something along this lines.

bojanz’s picture

Let's go with this then.

bojanz’s picture

Disregard #3, missed a spot.

Interdiff is against #1.

The last submitted patch, 3: 2401607-3-refactor-extensiondiscovery-scan.patch, failed testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you naming things in a sane way.

bojanz’s picture

Issue summary: View changes
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for adding the beta evaluation to the IS - it's definitely good for us to make composer manager's life easier.

Committed 1b738ca and pushed to 8.0.x. Thanks!

  • alexpott committed 1b738ca on 8.0.x
    Issue #2401607 by bojanz: Refactor ExtensionDiscovery::scan()
    

Status: Fixed » Closed (fixed)

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