Ryan's blog

Drupal core upgrade via subversion holy grail

If you're like any decent Drupal dev, you avoid Drupal core hacks like the plague. Sometimes, however, they are unavoidable. Regardless, Drupal upgrades still require one to perform file directory moves that may or may not be cumbersome depending on your chosen codebase layout.

Add to this the perceived complexity of upgrading while using a revision control system like subversion. Subversion is fantastic for managing code for projects with multiple developers on the team, or across multiple machines, especially for both. But it presents issues when attempting the traditional Drupal upgrade I've done in the past: suddenly I no longer feel comfortable moving files and directories around, willy-nilly, as I attempt an upgrade.

Luckily we can use subversion to make the upgrade process super easy.

Example site (Brainquest.com actually)

When I imported the site into the subversion repository, the Drupal core version was 6.4.

Here is my current repository layout:
/trunk/
/trunk/drupal-core/ -- we'll store copies of Drupal core here
/trunk/site/ -- entire site codebase

  • The upgrade should be completed on a working copy that is not currently running your website! Checkout a copy of your entire repository in some other temporary location if you need to, or work from a local copy.
  • Download and import a fresh copy of Drupal 6.4 with the sites directory and extra core themes stripped out (but never garland!). I put it in /trunk/drupal-core/
  • Copy the drupal-6.4 directory to the name of the new version, in this case "drupal-6.6"
  • Update the working copy so you have the Drupal 6.4 copy as drupal-6.6
    • svn up
  • From within the same directory (/trunk/drupal-core/), download the newest version of Drupal core (6.6 in this case), then write over the drupal-6.6 directory as you unpack the Drupal 6.6 archive.
  • Once again, strip the sites directory and the core themes (but never garland!)
  • commit the changes
    • svn commit -m "Importing Drupal 6.6"
  • We should now have:
    /trunk/drupal-core/drupal-6.4/
    /trunk/drupal-core/drupal-6.6/
  • browse to /trunk/site
  • Merge the difference between the two clean Drupal core copies into your actual site codebase:
  • This will upgrade your local working copy ONLY, so don't be too scared of breaking everything even at this late stage in the process.
  • Check for any conflicts and differences by running:
    • svn status
    • svn diff
  • You should see lots of timestamp changes in module info files at the very least. If you don't see any conflicts, commit:
  • svn commit -m "Upgrade site to Drupal 6.6"

That's it! Your codebase is upgraded, and your nasty core changes have been preserved, you dirty bugger. For every site that runs on a copy of this codebase, run "svn up" to update the local working copy of the codebase, and run update.php to run any database updates.

Sweet merciful Jesus, it's been a good 12 months

Nov 2007:

* Charlottetown, that's where it always begins.
* Ottawa for Human Rights Internet briefing
* Montreal for Netcorps training (9 days)
* Charlottetown to pack
* London, England with Thomas and Heather (5 days)
* Cape Town, South Africa

Dec:
* Tanzania and Zanzibar for the Christmas holidays (13 days)

Jan 2008:
* Zanzibar (7 days)
* Cape Town, South Africa

March:
* Paris, France with Thomas, Mitchell and Heather (6 days)
* London, England with Mitchell (2 days)
* Charlottetown, in one piece, luckily.

April:
* Cuba with the whole fam (7 days)

May:
* UPEI Graduation
* Move to Montreal

June:
* Ottawa for a Drupal meetup

July:
* Red Deere visiting the Bob Palmers
* Calgary visiting Matt, Andrew, Jill, Benji and co
* Fort McMurray visiting the Foys
* Back home in Charlottetown (4 weeks)

August:
* Back to Montreal to catch up with Matty Mayer

September:
* Toronto with the SA crew + J-money and others (4 days)
* Montreal

Overlooking the Ngorogoro Crater

Painting by Judith Oliphant

L-R: Amanda Kerr, Yara Amer, Ryan Palmer, Andrew Stern, Benjamin Oliphant (somewhat hidden by the Seamonstern)

(map)

Winter on the way