conf_path

Boris Mann
2007
03
04

Cleanly overriding core modules in Drupal through the magic of multisite

Blog
created on Mon, 2007-04-02 16:14

I recently got an email from Mark Shropshire (apparently emailing from the depths of a secret research lab at UNCC) asking about an article I had written giving feedback on one of IBM's Developerworks articles, where I talked a bit about some best practices around multisite, symlinks, etc.

The bit that got him interested was this paragraph:
Overriding a core module is no problem. Any core module you place in /var/www/html/sites/domain.com/modules will override the main install core module. This is a safe way to have patched core modules without having to wonder if you'll run into trouble updating your main Drupal install.

Yes, it's true. With the power of Drupal's magic multisite file path scanning, you can place a module in your local sites/domain.com/modules directory and it will override modules that are "higher" up the search path. But, Drupal tries to thwart you by sneakily caching the file path to modules in the system table, which only refreshes when you go to the Admin / Modules page. Here's how to get that "local" module enabled instead:

0. Put your site in offline mode
1. Go to admin/modules (4.7 and earlier) or admin/build/modules (5.0 and up)
2. *Disable* the core module you want to override and submit the page (you should already have the override module in place)
3. Re-enable the same module, and you should now be running the "overridden" version

Syndicate content