An exercise in staying the same only better, with the Drupal 6-to-7 upgrade of NHS Forest

As Drupal 8, like Christmas, comes ever closer, moving away from Drupal 6 becomes ever more important. While some will be waiting for the proposed D6->D8 upgrade path, there are others who will benefit from going straight to D7: after all, a lot of us would want to wait until D8 reaches the plateau of productivity before making full use of it.

Whole-version upgrades of Drupal sites can be quite problematic, even between two close versions. So I was excited to be able to helped Agile Collective with the upgrade of the NHS Forest website from Drupal 6 to Drupal 7. Given the time and budget constraints, upgrading had to be a fast, focussed process; it needed to be almost 95% automated, so that it could be run repeatedly, and tweaked each time; and the ultimate remit was one that often strikes fear into developers' hearts: build a new one, but have it work (and look) the same as the old one.

tl;dr: the end result

Here's how it looked before:

And here's how it looks after:

Not much difference, right? But that's the point: the new version is now running on Drupal 7, and a good few years of technical debt has been paid back.

How we did it

It all turned out to be much easier than you might expect, based on that remit. The automated command-line upgrade tool drush sup came to the rescue once again (I've blogged before about how I used it to upgrade this very website) and did much of the heavy, repetitive lifting. Other Drush commands let us e.g. automatically migrate the content from D6 CCK to D7 Fields. And while very few views survived entirely intact, a custom Drush command was quick to write (using drushify) to inject fixed versions of the views, after migration.

What's most interesting is that porting the theme was probably improved by it being based on a very basic theme in the first place: Framework. While the initial forking of Framework for the D6 site clearly involved a lot of work, it ended up a bit like paying technical debt in advance. In D7 we used a child theme, based on Framework, and while a lot of CSS selectors needed changing, the end result was very similar, as you can see: this was the result of perhaps a day or two of initial converting of the CSS, followed by many small tweaks throughout the rest of the project as new functionality came on board. I don't want to decry complex themes like Omega (not since my Damascene conversion at DCNW) but I do wonder how long it would have taken to convert an Omega 3/D6 theme into an Omega 4/D7 one.

Next steps

Once we'd deployed the upgraded version of the site, we were able to move onto more interesting new work, and do it rapidly as well. We've now launched a responsive version of the site: on a quick-win basis, we're still going for the low-hanging fruit, in a "mobile last" environment, but here's how far that's come in only a few hours:

As a work in progress, there's still scope to make further improvements to the responsiveness as we go on.

In addition, since the D7 go-live, we've added the Twitter Pull/OAuth stack:

This was very quick to do. In fact, there are a lot of small ongoing requirements with the website, that should now be very quick to do: some of them would have been doable in D6, of course; but you're always wary of committing to any work on an aging platform, when there's so much more possibilities in the newer one.

Summary

All in all, I think it's been a real success. The upgrade project came in well under budget, leaving immediate resources for the two improvements mentioned above, and maybe more in the new year! I'm really proud that Agile Collective asked me to be involved in it, and I'm looking forward to more upgrades to D7 and D8 in the future!