Upgrade Drupal 6 to Drupal 7

With Drupal 8 coming, Drupal 6 will be deprecated. Many wary Drupal 6 site owners upgrading. Which steps should you follow?

With Drupal 8 becoming closer and closer, there has been a revival of interest of upgrading Drupal 6 sites to Drupal 7. The reason is simple - site owners don’t want to end up with an unsupported Drupal version. With the coming of Drupal 8, Drupal 6 version will be outdated and no longer supported. And, as a matter of fact, you can’t upgrade skipping versions, like Drupal 5 to 7, or 6 to 8 directly. This explains the resurgence of interest. Even with Drupal 8 not yet ready, many are willing to upgrade 6 to 7 not to lag hopelessly behind. And that is wise.

Here are a few suggestions, or, steps, that will help you upgrade Drupal 6 to 7.

I. Do a discovery

Why? Because if you do no discovery, you may run into a very hellish situation, where you will need to rewrite lots and lots of code, and you or client may not know about it.

What to look for:

1. Are there any custom changes to drupal core or contrib modules? This is a bad practice, but some developers sometimes actually edit core and contrib modules to do their task faster. When you upgrade, you know what’s gonna happen! It’s hard to find such edited places, so you should ask your client if he knows of such cases, and have him ask initial developers if possible, unless you know the initial developers to be a good Drupal company, who would not carry out bad practices.

2. Are there custom modules? If there are, you will need to upgrade them to Drupal 7 API!

3. Is there any functionality written in a theme, that should in fact be in a module? You will need to extract it and put it in a new contrib module.

4. Are there unsupported modules? Modules, that have been dropped support in Drupal 7, in favor of some other modules? Take a note. This can be lots of work.

5. Are there changed design and UI patterns that the client needs to be aware of? In file upload interface, Drupal 7 has an ‘upload’ button. It is a feature, yet I saw some customers complain about that ‘confusing addition’. Client needs to be aware, that some things will change. And you better tell what and how.

All these things will influence time and cost of upgrade. Neglecting these, or following the general feeling that the site is ‘simple’, can end up in time and finance loss of you, and dissatisfaction for the client.

II. PREPARE

1. Put the site offline. Why? because you don’t want people to visit your content while you clear the caches.

2. Clear cache, watchdog, sessions, and search tables.

3. Back up the database and codebase.

4. Put the site online. Why? Because you will not perform upgrade on the production server.

5. Take the database and the codebase, and create a testing environment. Now we can do the actual upgrade!

III. UPGRADE WITHIN MAJOR

1. Set the theme to Garland. Why? Because your Drupal 6 theme will not work for Drupal 7, and Garland is present in both versions of Drupal.

2. Upgrade your Drupal 6 site to latest major. If your site rund Drupal 6.27, and the latest is 6.28 - upgrade to 6.28. Why? Because Drupal 7 upgrade paths will be catching from where the latest version left off.

3. Upgrade your modules to latest major. For the same reason.

IV. UPGRADE CORE TO THE NEXT MAJOR

1. Write a list or make a screenshot of which non-core modules were enabled.

2. Disable all non-core modules. Disable, but don’t uninstall! Why? Because we still need data that they have in the database, and if you uninstall them, that data will be lost, and your site thus impaired.

3. Cut the non-core modules folder and paste it somewhere outside of the server. Why? Because you later may forget, which modules you used. Also, likewise, save your old theme.

4. Back up items you will need: old non-core modules, old non-core theme, old .htaccess file (if it has custom lines) and settings.php file (for database credentials and possible custom config).

5. Delete everything that pertains to Drupal 6 core. Leave only /files folder (if you had previously upgraded from Drupal 5, you might be having it in /files rather than /sites/all files), and /sites folder. Everything else is pretty much gone.

6. Extract the latest Drupal 7, run update.php.

V. UPGRADE CONTRIB MODULES

1. Download new modules. Where possible, note the dependencies - many Drupal 7 modules have changed dependencies. You are likely to be required chaos tools, entity, library, and other new modules to provide a better API layer for Drupal 7. There may be other dependencies that you should satisfy.

2. With all new files in place, run an update script. If you have any errors, try re-running the script. If you still have errors, check if you have right minor versions (for instance, if you have views 7.3 rather than 7.2), and such. You may want to visit issue queues if you have errors that you can’t fix.

3. Enable the modules that you made a screenshot (or list) for.

4. Upgrade the custom modules to Drupal 7 API if any (this is the tough part!)

5. Upgrade the theme to Drupal 7 API.

VI. TEST

Now, you should be having a completely working site. But are you sure? Click around. Check the fields. Check the files. Check the content types. Run cron. Any errors? Edit some content. Create some content (and delete). Make sure everything works. There are likely to be some issues that you miss, that the client will discover in use, so let’s not add to these.

VII. DEPLOY

1. Repeat the PREPARE section, back up the site and code base.

2. Deploy. Yahoo! Ask the client to test some more. Warn him, to contact you if any strange behavior is spotted or errors are displayed.

A small development

Here is a link to my article analyzing some aspects why you might want to migrate to Dripal 7 rather than wait for Drupal 8.