Upgrading Drupal from 4.6 to 7? It can be done.

Drupal Upgrade
Ryan Gibson

Recently, I was challenged with upgrading a Drupal site from 4.6 to 7. If you're not too familiar with Drupal, you might not realize that Drupal must be upgraded one major release at a time. For those of you who are counting, that's four major version upgrades (4.6 -> 4.7 -> 5 -> 6 -> 7). This might not seem like a big deal, but depending on the site, this can be a tricky process. When you consider that with each new version, there are Drupal API changes to consider, contributed modules that may or may not be available (not to mention custom modules), and depending on how far back you go, PHP compatibility issues. 

It should be noted, that upgrading from an older version may not always be the best solution. This is particularly the case for large or complicated sites where custom modules were used heavily or where core has been hacked (never hack core). In those cases, it may be a better idea to migrate the content and build the site anew.

While it was certainly not the most exciting thing that I've ever done, I can say that with each successful upgrade there was definitely a mental fist pump happening. I also learned quite a few lessons along the way and was faced with a few pretty tough challenges. Here's a few of them, some are simply best practices:

  • it's never a good idea to perform upgrades on a live site without first testing them locally or on a development site. If you're not familiar with setting up a local environment, you should be. It will take the guess work out of making changes directly to code on a live site.
  • code and database backups are a must at each stage of the upgrade process. I made a backup of the original 4.6 site and then one with each subsequent upgrade. A good idea is to setup a git branch with each upgrade (e.g. "drupal5","drupal6", "drupal7"). Another benefit of using git to do this is being able to compare changes to code that are actually taking place. If you're unfamiliar with git, there is a learning curve, but there is information on how git and Drupal work together. Also, I often reference this fun simple guide to git.
  • something else that's easy to forget is to disable subthemes and set the default theme to the version default. 
  • take note of which modules are installed and enabled on the original site before you disable and remove them. Remember, you are updating Drupal core - you will have to replace any contributed modules with the upgraded equivalent - custom work will have to be ported to the upgraded versions as well. This has to be done with each major version upgrade so that you can also run database updates.
  • if you run into any error messages or failures during database updates, remember that there's nothing new under the sun; copy and paste the message in Google and figure out how others have solved the same problem. If that doesn't solve your issue, jump on Drupal IRC and ask for help. The Drupal community has helped me through a great deal of headaches. 
  • go ahead and expect that when you have finished upgrading to the newest version of Drupal there will be plenty of configuring, re-enabling, and  tweaks left to be completed (but that's the fun part right?). 

With some patience and determination, you can get your Drupal site upgraded - even if you are still rocking a 4.6 site - good luck!

Ready to get started?

Tell us about your project