Castle Builder Blog

Upgrading Drupal 6 to 7

by Amélie Walker-Yung

Drupal is one of the content management systems that Castle Builder tackles almost daily. The latest version of Drupal is 7. Drupal 8 is in beta, so Drupal 6 is on its way out. The current estimated “end of life” (ie. no more security updates) for Drupal 6 is summer 2015. If you are using Drupal 6, it is the time to start making your move.

Unfortunately, upgrading from 6 to 7 is a migration rather than a straightforward upgrade between minor versions. Much of the upgrade/migration process is tedious but not difficult. Very careful planning, backups and following upgrade directions exactly is key. I find this article on OSTraining.com to be a really good starting guide. Here are a few pointers, warnings and solutions you may find useful when going through the process.

Back up everything. Use a tool like phpMyAdmin to download your database. Empty your site cache and all cache tables before you do this. If you do not need to maintain access logs or watchdog stats, empty these tables (truncate, do not drop!).

Disabling all but core modules may seem like a step to skip, but don’t. This can take awhile, as many modules are dependent on each other and can cannot be disabled at the same time.

One warning to their instructions, if you use FTP to upload the new version of Drupal (see their step 13). Watch on upload that you do NOT replace the sites directory. Depending on the FTP program you use, you may indeed need to worry about overwriting files.

Running update.php can take a long time, so just be patient. Leave it running and go get some coffee! Note all errors and re-run until it makes all updates.

Some of your Views may have broken handlers, so you should check every view to see any you need to fix. This should take care of most Views-related variable errors.

Drupal 6 to 7 Theme Upgrade

Updating the theme is one of the painful parts of the migration!

In Drupal 6 you probably used CCK (Content Construction Kit) fields. These no longer exist, as much of that functionality is part of core. You will need to use the CCK Content Migration Module and possibly install some additional modules. More info and instructions can be found here: www.drupal.org/node/1144136

CCK MIGRATION FAILURES: There Will Be Errors, Don’t Panic

If you have text fields that are more than 255 characters, you are going to run into trouble. Before you migrate, change each of these to text areas. If you have already migrated and get the error, there is a solution. In your Drupal 7 database, go to the old Drupal 6 table “content_node_field_instance” and replace “text_textfield” with “text_textarea” for the needed fields. Go back to Migrate, and they should be imported without a problem.

After migrating date fields, some nodes that use date fields may be blank. Before trying anything else, go to Structure -> Content Types -> [your content type] -> Manage Display and re-save. There is no need to edit anything, just go in and click save. This will often fix the issue.

Note that Imagecache becomes Image, part of core.

THEMING CODE TIP: Image Title as Caption

In Drupal 6, you could use the code below in a template to use your image title to print a caption:

<?php print $field_image[0][data][title]; ?>

To do this in Drupal 7, use:

<?php print $node->field_image[‘und’][0][‘title’];?>

(replace field_image with your image field name)

Why not use Drupal 8 as soon as it comes out?

Drupal 8 is not out yet (a beta release is available for testers) and probably won’t be ready or recommended for real use until early 2016. Why?

Well, even when the core software is officially released, the modules that most websites depend on will not all be updated. Module developers generally need to wait for a stable version before porting their modules over. Some won’t ever release a new version, and you will have to find another to meet your needs or develop your own.

Since Drupal 7 will be supported until at least 2018, it will be your best bet for building new Drupal sites for awhile.

Published on November 5, 2014.

About Amélie Walker-Yung

Amélie, the founder of Castle Builder Design, has been constructing a wide variety of websites since 1997. She manages all projects and specializes in crafting visually compelling yet clear-eyed designs, all the while taming open source software. She sees a successful website as a puzzle solved through the seamless integration of its two vital elements: beauty and function. In her spare time, Amélie is the membership coordinator of Webgrrls NYC and bakes cupcakes.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.