Painless relocating of Drupal modules

While upgrading to the latest version of Drupal, I was thinking that it would be nice if the 30 or so "after market" modules that I had installed could be moved out of the (rather cluttered) modules/ directory into a sub directory. Here's one approach I found for doing this, with minimal disruption to the site:

1) mkdir modules/local
2) mv module1.module module2.module module3.module [...] local
3) Reload /admin/modules for each site that runs off of that Drupal installation

The key here is step #3. The act of merely loading the modules page causes the entire modules/ directory to be recursively searched for modules, which are then written to the system table in the database and then displayed on the screen. As soon as that table is rewritten, any attempts to load any of the modules that were moved will cause them to be read from their new location on disk.

This is with Drupal 4.6. Your mileage may vary with other versions.

No votes yet
Your rating: None