admin

Keeping Drupal up to date

Drupal depends heavily on contributed modules to implement a lot of it's functionality. One of the benefits of this is that the system is very modular and it's easy to configure the proper set of functionality. On the down side, this can lead to module creep, where you install lots of modules that you don't "really" need because they do something cool. Among other things this can make keeping up with new module releases a pain.

Lately, I've been addressing this problem with a combination of drush and update_status. Drush is available for both Drupal 5 and 6, and update_status is a contrib module in 5, and in core for 6.

It's pretty straightforward. Update_status gives you an admin page (and can also notify you via email) displaying which modules you have installed, and if any of them have updates available, especially security fixes. Drush, on the other hand, is a command line interface to the Drupal system that allows you to manage packages from the command line (similar to apt-get on a Debian Linux system), run database queries, and other maintenance tasks (cloning database and directory trees, etc).

I install drush into sites/all/modules on a Drupal site and enable it in the system, including the Package Management, wget, SQL support, and toolbox modules.

Then, from the site root, one can run UNIX shell commands such as


php sites/all/modules/drush/drush.php pm update og

This particular example updates the organic groups module, which the update status page has informed me is out of date. Once I've updated the module, I run /update.php to apply any necessary database schema changes.

And that's pretty much it. I'd like to see automatic application of schema changes and automated rollback (so that updates are an atomic operation), and so on, but so far it has seriously reduced the overhead of bringing sites up to date. These two modules are the first that I add to any new projects I'm working on.