Web development‎ > ‎

Drupal 6 to 7 upgrade

posted 14 Mar 2014, 09:20 by Tom Cooper
A big project at the moment is the upgrade of www.pushhockey.co.uk from Drupal 6 to Drupal 7. I created the site originally on Drupal 4, I seem to recollect. It has been at Drupal 6 for at least a couple of years but there have been a few developments held up by the need for the Drupal 7 structure. You can see the 'after' on the left.

Biggest upgrade yet

This is a much bigger job that any of the other upgrades. The site has around 3000 posts and a similar number of images. The images are the biggest headache with the upgrade as with Drupal 7 images move to core and are no longer a contributed module. That has to be positive in the long term, but it causes a few upgrade issues. More on that later.

Pre-planning

There is a lot of work involved in just going through all the contributed modules in use in Drupal 6 and then working out whether they are needed in Drupal 7 and whether there are equivalent version 7 modules. It could be they aren't done (yet) and if you cant develop them yourself (that includes me!) then you may have to postpone your upgrade, or consider whether the facility in the contributed module is really necessary.
This is also a really good time to tidy up and remove (preferably by uninstall, if available) modules that are not being used. Ditto for taxonomy, content types menus etc.
You also need to decide on a strategy. The low-stress approach for a live system is, for me, to build a complete copy of the old one on a completely different server/virtual server, then upgrade the copy before finally switching over the DNS records when everything is sorted. That works in this case because there are relatively few sales/renewals over a weekend, so the shop side of the site can be mothballed for a while. 
You can even keep the old system running for a while under a new name so when people say it used to do this, you can show them it didn't. You might also want to review your hosting package at this time. The server swap might not be possible for you, but whatever you decide you need  a decent test system to do the build on first time - there will be problems!

Checklist:
  • Work through all the contributed modules in the system and decide, delete, upgrade or, well something
  • Tidy up any unused menus, content types and even blocks that you are never going to need again
  • Have you got a fully functional test system to try? You need one
  • Make sure you can backup and restore your database and make archive copies of your web root - these are invaluable when things get a bit messy.
  • If you are going to build a new server for this you might take the opportunity to switch hosts. Think about whether you want the extra hassle now, or later.
  • Decide what you are going to do with images - more on this below.

It's all about the images

You really need to have a good think about this. In Drupal 7 images are a field type on another entity rather than an entity in themselves. You can convert D6 images to fields using a contributed module - see https://drupal.org/project/image/git-instructions. The only problem is you might loses some of the connection between say a Blog post and the image inserted into it. Because Image was not in core in Drupal 6, there a many wondrous variations on how that connection was made. 
Over time, on www.pushockey.co.uk we have used HTML code in the node (usually generated by some sort of WYSIWYG editor) and most recently the nifty Image Insert module.
It is Image insert that is the big problem as it inserts tags into a node like:
 img_assist|nid=8764|title=|desc=|link=node|align=right|width=220|height=307
It is then left up to the input filter to convert that to an actual image when the node is displayed. Remember Drupal input formats describe how the item is displayed - all content is actually stored native.
I rally didn't want to keep using image assist in D7 as it has encouraged a rather messy website with randomly sized images spread at various points in text. The prospect of adding a image field to text nodes and then using a decent template to promote consistent rendition is really tempting. Plus at the time of upgrade, image insert was still a work in progress at D7.
I finally decided to:
  1. Convert the images to a new node type with an image field attribute
  2. Accept that the Image Assist legacy content was never going to be linked back and came up with an input format to blank off the img_assist tags.
Not ideal, but just about acceptable to us. All the old images are still on the system and searchable. Where I want to re-use them I can use Media Browser Plus to insert them into the article nodes.

Media Browser Plus
This is one of the real bonuses of the upgrade. If you are anything like me you use a lot of 'library' pictures. I never found a way of effectively managing our back catalogue of pictures within Drupal. Now it is just about possible. Images can be uploaded as 'File' content type and then inserted as image fields into nodes with captions and so on.
Media Browser Plus let's you filter and find files by taxonomy and filename. In the end I re-loaded all my old images using the image upload facility then used Views Bulk Operations to add taxonomy to them, initially to sort them by date. As I re-find them I am slowly reclassifying by something more useful, as you can see in the screenshot.
New files can be loaded via the /admin/content/file dialogue.
The only facility I'd like to see is to be able to tag images with more than one taxonomy term say 'Olympics' and 'Players' you can try that if you want, but it doesn't work at the moment.

Themes

You will need a new theme, so this is a good time to give your site a makeover. I switched to theme News Center. That had its challenges as it is only supplied as a clean install theme. Here is a look at the old website below.

Comments