Upgrading Drupal 5 to Drupal 6 in Detail

Fri, Sep 18, 2009 by Rexx

I worked on a project that required me to upgrade an existing Drupal 5 website to Drupal 6. After researching on how to tackle this project, I found a great tutorial on drupal.org, http://drupal.org/videocasts/upgrading-to-6. Just like any software development, I broke this problem into managable pieces and started tackling them one by one. Before starting the upgrade, I setup a repository of this Drupal 5 instance and created a database snapshot. After each step of the process, I created a snapshot of the database and "commited" any file changes to the repository. From this, I was able to keep track of my progress, and I was able to revert to the previous state of the site in case something was to happen.

Here are the following steps to update a Drupal 5 website to Drupal 6:

1.Update your site to the latest Drupal 5 release and run update scripts, if any.
2.Go through all your contributed modules and check to see if they need to be updated to the latest Drupal 5 release before upgrading to the Drupal 6 version.

NOTE: If you are using CCK, it is advisable to update it to the latest Drupal 5 release. If you are using Workflow module, export your "rules" and save it as a file so that you can import back.

3.Disable all your contributed modules
4.Replace all Drupal 5 files with Drupal 6 files, except the “sites” folder.
5.Change your theme to Garland or other theme you prefer.

NOTE: You can omit this step, but I find the site less intimidating and scary if it is somewhat themed during the upgrading process.

6.Navigate to update.php and run all core update scripts.

NOTE: Step six does the necessary database changes, such as adding/removing core table fields. Once this step is done, your Drupal 5 core module tables will resemble the Drupal 6 tables.

7.Replace all Drupal 5 contributed modules with its corresponding Drupal 6 version.

8.Navigate again to update.php and run all update scripts. This will convert all Drupal 5 contributed module tables to its Drupal 6 version.

NOTE: There are some modules such as FAQ that has renamed one of its permissions from “view faq” to “view faq page” so you might want to set the permissions manually or perhaps you can write an update script that.

9.If you have custom modules, convert the modules that interact with the Drupal core, or modules which extends functionalities of your contributed modules, by replacing Drupal 5 hooks to its Drupal 6 version (hook_form_alter). You should also watch out for functions that have changed (taxonomy_node_save).

10.Convert your theme to its Drupal 6 version.

NOTE: The way you declare regions in Drupal 5 is different from Drupal 6.(see http://drupal.org/node/132442 for more information on theming changes)

Arnold Leung posted on September 21, 2009 2:56 pm

It is definitely true that blocks should be free of custom code as much as possible. This will make the code base more maintanable as there is no SVN for database.

Wim Mostrey posted on September 21, 2009 7:45 am

To anonymous: blocks and pages with php code should probably be in a custom module, which should be upgraded anyhow.

Anonymous posted on September 19, 2009 2:56 am

Also make sure you upgrade any custom blocks or pages with PHP in them.

Wim Mostrey posted on September 18, 2009 11:08 pm

In step 4 you mention "Replace all Drupal 5 files with Drupal 6 files, except the “sites” folder." While it's true that you should keep a copy of your settings.php file to make sure you have all your settings saved, the new settings.php might contain new settings and options. So keep your "sites" folder, but make sure your settings.php is up to date.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h2>
  • Lines and paragraphs break automatically.

More information about formatting options