Closes #320: Extensions in sites/<site-dir>/modules not discovered and autoloaded#956
Open
dpagini wants to merge 4 commits intomglaman:mainfrom
Open
Closes #320: Extensions in sites/<site-dir>/modules not discovered and autoloaded#956dpagini wants to merge 4 commits intomglaman:mainfrom
dpagini wants to merge 4 commits intomglaman:mainfrom
Conversation
Author
|
@aweingarten just pinging you here b/c you opened #320 (even though it was 6 years ago). Not sure if you have any thoughts on this one... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ExtensionDiscovery doesn't scan multisite directories, causing false "module is not found" errors
Problem
ExtensionDiscoveryhardcodes the site path tosites/default:In a Drupal multisite setup, modules can live under other site-specific directories like
sites/acme/modules/. BecauseExtensionDiscovery::scan()only searchessites/defaultfor theORIGIN_SITEweight, modules in any other site directory are never added to theExtensionMap.This causes the
LoadIncludesrule (andModuleLoadInclude) to report false positives:Steps to reproduce
sites/acme/modules/acme_module/loadInclude():Failing test
❌ Failing test evidence for commit 718ef91
Branch
320adds a test demonstrating this bug. The test places a fixture module undertests/fixtures/drupal/sites/acme/modules/and asserts thatloadInclude()resolves it without errors. It currently fails:Proposed fix
Replace the single
$sitePathproperty with discovery of all site directories undersites/*/. Inscan(), iterate through each discovered site path with theORIGIN_SITEweight, skippingsites/all(already handled) andsites/simpletest(irrelevant).This mirrors what Drupal core's own
ExtensionDiscoverydoes when no specific site path is provided — it scans all site directories.Disclaimer: some contents written with help of AI