I want to move all of my contrib modules (both enabled and disabled) to a different directory (they are now in a 'contrib' subdir and I want to back them out of that directory).

When I try moving the modules, the site dies with this error:

Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/contrib/entity/includes/entity.inc' (include_path='.:/usr/local/share/pear') in includes/bootstrap.inc on line 2982

So I tried to run update.php, but that goes WSOD.

So.. is there any means to move modules which succeeds? It seems odd nobody ever thought about doing this.

I use drush, so if there is a drush method, that solution is welcome as well. (I've already tried drush cc all, which gives the same require_once error)

Comments

gbrands’s picture

I've never actually tried this before, but the module location is stored in the 'system' table of the MySQL db. You can move your modules to your desired location and update the 'filename' column with your new location.

You can try it with Drush too. You might need to run the following command first:

drush sqlq "UPDATE system SET filename = REPLACE(filename,'modules/contrib','YOUR_NEW_LOCATION') WHERE type = 'module';"

Then migrate your modules and run drush cc all

Hope this helps!

matt v.’s picture

The Installation Guide has a page on Moving modules and themes.