If I have a module in sites/all/modules named dc_front and then I have a module in sites/default/modules named dc_front, which one gets used when it is enabled?
It appears the module in default gets used.
Is this expected and reliable behavior?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
drupal_system_listing() is the function that handles this.
According to its inline documentation:
// Duplicate files found in later search directories take precedence over // earlier ones, so we want them to overwrite keys in our resulting // $files array. // The exception to this is if the later file is from a module or theme not // compatible with Drupal core. This may occur during upgrades of Drupal // core when new modules exist in core while older contrib modules with the // same name exist in a directory such as sites/all/modules/.
And as far as I can tell from the function, it searches directories in the following order:
So each directory in the list above would override matches from previous directories.
Having modules in the
/sites/default directory is not normal, so I'm not sure what the expected behavior would be. My guess is that it depends alphabetically on your
[domain] directory name.