Upgrading to Drupal 6 | How to Upgrade a Drupal site from version 4.x / 5.x site to Drupal version 6.x

| | 4 min read

Upgrading a Drupal site refers to moving it’s database and files from one major version of Drupal to a later one, to take advantage of the newer features and bug fixes that might not be available for the older version. Upgrading a Drupal site is a pretty effective way to make sure that your Drupal site is currently up to date with all the latest security updates and bug fixes. Old versions of Drupal will naturally be unsupported with the arrival of the new releases. The Drupal community has currently stopped supporting the older versions of Drupal like version 4 and 5 and has moved to Drupal 7. However Drupal 6 is more widely supported. Have a look at the steps required to upgrade your Drupal site from an older version to Drupal 6.

Keeping your Drupal site up-to-date is necessary to make sure that you’re not left behind with a chunk of unsupported code as time passes. Updates and upgrades are necessary to ensure the smooth functioning of your Drupal site. Upgrading a Drupal site refers to moving it’s DB and files from one major version to a later one, to take advantage of newer features and fixes that might not be available for the older one. (On the other hand, updating refers to moving from one minor version to a later one).

Many sites still use the 4.x and 5.x versions of Drupal, which the community has officially stopped supporting/maintaining. Drupal.org asks for all these sites to be upgraded to the latest 6.x version to ensure smooth updates and fixes.

Here we show you how to upgrade your Drupal 4.x or 5.x based site to version 6.x.

The general strategy that we follow would be to update through minor versions till we reach the last available minor version for that major version (that would be 4.7.11 for 4.x, 5.23 for 5.x), and then to upgrade to the next major version’s first minor version.

We will continue this process till we reach the last minor version for 6.x.

For example, if we are now on Drupal 4.7.1, we update through all 4.x minor versions till 4.7.11, and then upgrade to 5.0. Following that, we update through all 5.x minor versions till 5.23 and then upgrade to 6.0. Then, we move through the 6.x stream till we reach 6.22 which is the latest 6.x minor version as of the date of writing this HOWTO.

HOWTO:

  1. It would be easier and safer to perform the following updates and upgrades on a local copy of the site. Make sure you have the local LAMP environment as similar as possible, to the production environment (especially PHP - version, extensions). After finishing and verifying locally, you can upload both the DB and files to the production server.

  2. Since such an upgrade is a time consuming and risky process, make sure you take backups all along the way. Things would be much saner if you use a VCS such as git.

  3. Login as the default admin user (user/1), so that you have permissions to run update.php.

  4. Check for all php/drupal function syntax changes/deprecation along the 4.x to 6.x path.

  5. Before each update/upgrade stage, check for code hacks and generate patches. Check in the documentation both on drupal.org and inside the module, for patches that might have gone in already, during the version change. After replacing the component core/module/theme, apply and verify those patches one by one, which have not already gone in. Before each update/upgrade, check the existing site components (core, contrib modules, themes) with their original drupal.org versions to find out whether there are any custom code hacks. If present, generate diff patches (diff is a good commandline utility for doing this on linux. MelDiff is a GUI version). Remember to document and maintain patches in a separate folder (patches). You can use the Hacked! and Diff modules for checking for code hacks. (Hacked is a Drupal module that helps you find custom code hacks in the site’s core, contrib modules/themes by comparing the existing code with original copies of their same versions freshly downloaded from Drupal.org. Hacked!, along with Diff, make things much easier).

  6. After replacing the code and applying patches (if any), run update.php, followed by cron.php.

  7. Check the ‘Recent Logs’ and ‘Status Report’ pages after each update.php run.

  8. To handle WSODs, add the following debug code in index.php:

    error_reporting(E_ALL);
    ini_set('display_errors', TRUE);
    ini_set('display_startup_errors', TRUE);

     

  9. Fix all errors - do not skip. Warnings may be ignored till the final stage.

  10. Before each upgrade, disable all non-core stuff (modules and themes). Follow the same procedure as for updates (mentioned above), for the Drupal core. Then upgrade and enable non-core stuff one by one.

  11. Before upgrading the theme, make sure you have set the admin theme to a default available core one (such as Garland).

  12. Test extensively during each stage of your upgrade.

As a general principle, move carefully, keep a descriptive log of your steps (would come automatically if you use a VCS properly), and test extensively.

With these simple principles in mind, fill up a snack bowl next to your desk, take a deep breath, and upgrade!

Dont have the time/patience to go through all of this, but want somebody knowledgeable to do this for you? We will be glad to take care of this and more! Contact Us