Drupal modules & themes, where should they go to make upgrading easy?

(2 minute read)

At the last Florida Drupal meeting one of the attendees (sorry, I’m horrible with names) asked why Drupal was so difficult to upgrade. At first we were a bit confused since we thought Drupal was easy to upgrade but we later found out that the user was storing his modules in /modules and themes in /themes so every time he wiped out his Drupal installation he had to re-install all of the files for his modules/themes. While it sounds like this is uncommon, I can assure you, it’s quite common for new (and some experienced) users to make this mistake.

Since Drupal 5.0 user modules and themes need to go into /sites/all* so modules go into /sites/all/modules and themes go into /sites/all/themes to alleviate this problem. This is very important since it will make upgrading and system maintenance easier in the future. With your modules and themes in /sites all you have to do is delete everything except for /files and /sites and copy in the new files (remember not to copy over the /sites directory if you are using the /sites/default/settings.php) to upgrade your installation.

If for some reason you’ve already uploaded your modules to the /modules directory it’s a pretty easy conversion. Just move the non-core modules into the /sites/all/modules directory and go to your administration module page and save the settings. Drupal will automatically update the path to your module files. The process is very similar for themes but be sure to test it on a development server just to make sure the theme author did not accidentally hardcode to /themes rather than using php code like:

<?php print path_to_theme(); ?>

*Assumes you are not running a mult-site setup, if you are, you should know where these files go depending on the scope.