Skip to main content
Clean drupal modules folder

Cleanup of Drupal modules folders

Keeping your drupal modules folder very clear is important part of development. This is the common structure :

  • Contrib - modules from
  • Custom - modules developed for the specific project
  • Features - exported features for Features-driven development

This structure will give better understanding about the modules to other developers and prevent them from hacking the Drupal's contributed modules.

In my case, all the contrib, custom, features were placed in single folder (sites/all/modules/). So the modules folder had nearly hundred modules, its too irritating for any developer. So I planned to move all the modules to their corresponding folders according to the common drupal folder structure. There were many issues after moving all the modules into specific folders.

Drupal's Registry rebuild module gave the opportunity to clear the registry through cli (drush/php) 

  1. Backup your database,
  2. Download and place the registry_rebuild module into your drupal modules folder,
  3. Move all the modules into their corresponding folders,
  4. Run drush rr command to clear all the registry in the database.

After clearing the registry the site is working like a charm, and its a big relief for any developer. 


Scott (not verified)

Wed, 04/08/2015 - 23:28

I like to also use a sites/all/modules/dev folder for development related modules like devel, devel themer, and PHP console. It is then excluded from the code base in .gitignore.