Updating your Drupal site using Drush

Madeleine Perry's picture



Updating your Drupal site using Drush

A few weeks ago, Alan wrote about how to find out if your Drupal and Wordpress sites are up to date. So, what if you find out your Drupal site is horribly out of date - core, modules and all? What then?

If you run the script Alan wrote about, or you simply notice the alert in the admin section of your site notifying you that your site has updates available, most of the time you'll want to implement at least some of these updates.

Note: The notice for updates is powered by a module called Upgrade Status. It's a good idea to install this module on your Drupal site so you don't let updates go by the wayside.

When you see the update notice, click “available updates” and see which updates are necessary. You can also reach this page by going to admin/reports/updates in your browser (for example, www.yoursite.com/admin/reports/updates).

The updates page will display which version of Drupal you are running as well as the recommended version of Drupal, and the same for each contributed module running on your site. If something is highlighted in green, it is up to date; yellow means there is an update but it’s not critical; red means you should update right away.

So, how do you update Drupal Core and contributed modules?

Generally, if your site is hosted with EchoDitto and/or you have a technical retainer with us, we will inform you of any critical updates and estimate the time needed to implement these updates. If you are hosting outside of EchoDitto or do not have a technical retainer, however, what follows is a step-by-step guide for updating your Drupal site safely and efficiently.

Note: As always, it's a good (read:great) idea to have a development site, separate from your live public-facing site. This should be used for any testing purposes, including updating Drupal core and modules. You should always do updates and testing on your development site first, before ever touching your live site.

In addition, it is always best to have a developer on your team take care of updating your site. Generally, site updates are tech-heavy, and require intimate knowledge of version control systems and database configurations.

My preferred method for updating modules and Drupal core is via Drush.

You’ll find a few possible ways of updating your modules and Drupal core below. I generally think you should follow whichever steps are appropriate depending on your knowledge of the tools at hand. Keep in mind the following steps are for updating on a development site only. For the purposes of this post, I'll go through the following scenarios:

  • Updating via Drush (with svn)
  • Updating via Drush (without svn)
  • Updating manually (with svn)
  • Updating manually (without svn)
  • Updating on your live site

Updating via Drush (with svn)

  1. Change to the root of your Drupal install
  2. Back up your database
  3. Run 'drush upc --version-control=svn --svnsync'. 'drush upc' updates all contributed modules, without running update.php OR updating core
  4. Update core: run 'drush up'
  5. Run 'drush updb' to update your site locally.
  6. Test locally before committing to your development site.
  7. Add any new files and commit your changes. Use 'svn add --force *' to force the addition of all new files.
  8. Use 'svn commit' to commit your changes.
  9. Run 'drush updb'
  10. Test

Updating via Drush (without svn)

  1. Back up your database
  2. Run 'drush up' or 'drush upc'
  3. Run 'drush updb' - this will run update.php


  • The 'drush up' command updates modules, core, and runs update.php
  • The 'drush upc' command updates modules only, and does not run update.php

Updating manually (with svn)

  1. Back up your database
  2. Download the new version of the module from drupal.org
  3. 'svn remove' the old module file ('svn rm sites/all/modules/modulefolder')
  4. 'svn commit'
  5. Extract the new module and place it in sites/all/modules
  6. 'svn add' the new module folder
  7. 'svn commit'
  8. Run update.php. Do this by going to www.yoursite.com/update.php
  9. Test, test, test

Updating manually (without svn)

  1. Back up your database
  2. Download the new version of the module from drupal.org
  3. Delete the old module directory, and replace it with the new downloaded copy
  4. Run update.php. Do this by going to www.yoursite.com/update.php
  5. Test, test, test

Updating on your live site

  1. Back up your database.
  2. Put the site into maintenance mode. You can find that setting at /admin/settings/site-maintenance and select “Off-line.” Customize your offline message as appropriate.
  3. Update modules and core (following whatever steps you followed above: drush (with or without svn), svn, or manually).
  4. Run update.php. Do this by going to www.yoursite.com/update.php.
  5. Test.
  6. Take the site out of maintenance mode.
  7. Test more.

Want more info? Here are some helpful links:

I see you like to read printed material. You should check out Nicco's book The End of Big: http://endofbig.com