1

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?

1 Answer 1

1

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:

  1. /profiles
  2. /sites/all
  3. /sites/[domain]

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.