Back to top

Upgrading a site from Drupal 6 to Drupal 7

Upgrading your Drupal installation

The process of upgrading a site from drupal 6 to drupal 7 varies depending on the complexity of your current installation.
Any Drupal upgrade has four general steps: Planning, Preparing your current site for upgrade, Upgrading, and Testing.
You can upgrade site between two major drupal versions. If you want to upgrade a site from drupal 5 to drupal 7 then you first need to upgrade it to drupal 6.
Before you start any upgrade process you should backup your whole existing site (database, core Drupal files, non-core files e.g. contributed modules, and file upload folders).

Make an Upgrade Plan

The first thing what you should understand before upgrading site is how your current site is built.

Module and Theme Inventory

Make a list of all the modules and themes installed and enabled in the site. The Update Status module can make this process much easier. It lists all modules installed on your site, their version numbers, and whether or not the most up to date version is installed.
Write down the complete list of modules and themes installed on your site. You can use this as a checklist when upgrading contributed modules as well as when you disable and re-enable modules during the actual Drupal upgrade.
Disable and remove all unused modules that are not actually in use for both security and performance reasons. During an upgrade you also save yourself from having to update or upgrade unused modules.

Contributed module upgrade planning
Checkout the following steps for upgrading contributed modules
•    Is Drupal 7 version of module available for current Drupal 6 module?
•    Has the module moved to Drupal core? Drupal 7 core has incorporated several key contributed modules into its release.
•    Is there an upgrade path for the version of a module you have and the version that is available for Drupal 7?
•    Does drupal 7 version of a module has introduced some new dependencies? Checkout if any dependency has been made for the current module on other modules which was not there in Drupal 6 version.

Theme Upgrade Planning

As you checked out for contributed modules, similarly checkout for theme also.
•    IF your theme is contributed theme then checkout if there is Drupal 7 version available for your theme?
•    If your theme uses some base themes such as zen or 960 then find out if there is an upgrade path available for these base themes.
Even if your theme is contributed one or totally custom or base in any base themes you need to upgrade the code of theme. There must a proper planning on this prior to starting site upgrade.

Make a note of upgrade plan (Documentation)

Consider documenting the following as part of your upgrade plan.
•    Modules that cannot be upgraded and what alternative choices exist.
•    Modules requiring an upgrade before upgrading the core codebase.
•    Special upgrade instructions (if any) for each module.
•    The order in which modules should be upgraded.
•    A plan for testing whether the upgrade was successful.

List of Drupal 6 modules which are included in Drupal 7 core

Below is a list of Drupal 6 contributed modules whose functionality now exists wholly or partially in Drupal 7 core. While upgrade you can remove these modules from your sites folder in Drupal 6 and reconfigure the settings in Drupal 7 as required.
•    404 Blocks
•    Absolute src
•    Admin:hover
•    Admin Role
•    Archive::Tar
•    AHAH helper
•    Already in
•    Autoload
•    Auto Menu Title
•    AutomaticMenu
•    Auto Menu
•    Block edit
•    Block Node Visibility
•    Canonical URL
•    Checkbox Validate
•    Comment Display
•    DBTNG
•    Documentation
•    Drupal Queue
•    Edit term
•    Elements
•    Element theme hook
•    File API
•    Filter Default
•    Image API
•    Image Cache
•    Image Field
•    Input Format Permissions
•    Javascript Tools
•    jQ
•    jQuery Cookie
•    jQuery Form Update
•    jQuery Plugin Handler (JQP)
•    jQuery plugin manager
•    jQuery UI
•    JS Alter
•    Login Security
•    Menuless Node Type
•    Menu Settings per Content Type
•    No Anonymous Sessions
•    Node Preview by Content type
•    Parallel
•    Permissions API
•    Plugin Manager
•    Poor man's cron
•    Preview
•    RDF
•    Secure Password Hashes (phpass)
•    Shortlink
•    Simple CDN
•    Simpletest
•    Site Configuration Permissions
•    Storage API
•    Taxidermy
•    TinyMCE AHAH Integration
•    TinyMCE Drag and Drop Integration
•    Transaction
•    Upload element
•    Upload preview
•    URL alter
•    User Cancellation
•    User Default Filter
•    User Delete
•    Vertical Tabs
•    View unpublished
•    Vocabulary Permissions
•    Wysiwyg API CCK Integration
Few modules such as token and better formats are also available now in drupal 7 core but additional contributed modules are also available for some remaining functionalities. You can uninstall these modules if additional functionalities are not required.

Modules that require Data Migration

D7 contrib modules that will handle the migration are as follows:
•    Content Construction Kit (CCK)
- There is a D7 contrib module to handle miscellaneous field functions - it includes the Content Migrate sub module to handle D6->D7 data migration. Node and user references have been split off into the References module. Content permissions, fieldgroups and content copy will be hived off into their own separate modules.
•    Content Taxonomy - - Will need to migrate data: on the module page it says there will be an upgrade path provided.
•    Date Timezone - This is a submodule of the Date module. Replacing the D6 version of the date module with the D7 version and performing any required upgrades for that module will suffice here.
•    Field Taxonomy - Will need to migrate data: so far, no indication on the module page of an upgrade path.
•    Filefield/Imagefield - A preliminary version of an upgrade path is provided in the Content Migrate submodule of CCK (see above).
•    Image - the image nodes will need to be migrated to FieldAPI using Field Converter module. Some functionality (e.g. import) will still exist in contrib in separate modules.
•    Taxonomy Delegate - may need to migrate delegation: so far, no indication on the module page of an upgrade path, although they are following D7 progress.
•    Taxonomy Intro
- Will need to migrate introduction field: so far, no indication on the module page of an upgrade path.
•    Term fields - Will need to migrate data: so far, no indication on the module page of an upgrade path.

Migrating D6 CCK fields to D7
Data must be migrated to upgrade Content Construction Kit (CCK) in Drupal 6 to Drupal 7 core fields. Most of the D6 CCK functionality is now part of D7 core. But few contributed modules needed as some of the D6 CCK functionality is being introduced in D7 as separate modules.
•    Node reference and user reference are replaced by either the References module or the Entity Reference module.
•    Content permissions require the Field Permissions module
•    Field Groups require the Field Group module.
Following are the steps required to migrate CCK from D6 to D7
1.    Download latest 7.x CCK module
After upgrading to Drupal 7, download the latest 7.x CCK module version. Typically this will be placed in your sites/all/modules or sites/example.com/modules directory.
2.    Enable the CCK Content Migrate module
3.    Browse to the Migrate fields page (Browse to Structure > Migrate Fields).
4.    The Migrate Fields page is divided into 3 sections:
Available fields- Fields that have not been migrated but are available for migration.
Converted fields- Fields that have already been converted. You can choose to roll them back if the conversion did not work correctly. Note that rolling fields back will completely destroy the new field tables. This operation cannot be undone!
Unavailable fields- Fields that cannot be migrated because some modules are missing. Download and install/enable any required modules listed in the other information column of this section.
5.    Download additional modules if necessary
Typically these will be placed in your sites/all/modules or sites/example.com/modules directory and enable if necessary.
o    References module  
o    Field Permissions module
o    Field Group module
o    Link module .Be sure to run update.php after enabling the Link module.
6.    Migrate fields
Browse to Structure > Migrate Fields or
Check the box next to all fields you would like to migrate in the Available fields section.
Press the Migrate selected fields button.
If the migration process is successful you should receive a message detailing that each field was created. All fields should now be listed in the Converted fields section of the page.

Upgrading

   Current Site Preparation
1.    Backup current site
It is always highly recommended to backup your site before any update or upgrade.
A full backup consists of making copies of:
•    all core Drupal files and folders
•    all contributed module files and folders
•    all contributed theme files and folders
•    all other files and assets that have been uploaded via your Drupal site (e.g. /files folder)
•    the Drupal database

2.    Update site to latest stable release of Drupal 6 – this is necessary as some minor releases might introduce some database schema changes which are expected by Drupal 7 when you upgrade.

 Test Your Current Site After Updating and Prior to Upgrading
Part of the reason for updating your site prior to upgrade is to ensure that you have a stable foundation on which to upgrade. Test to make sure your site is still working. If everything is working as expected it is a good idea to make another backup of the newly updated site to ensure that if something should go wrong during the actual site upgrade you have a known working restore point.

New Site Preparation

•    Download Drupal 7
•    Download Drupal 7 versions of the contributed modules you will need for your site.
•    Prepare the Drupal 7 versions of your Customized Modules or Customized Themes.
•    Create a test site location to practice your upgrade, check the content after the test upgrade to be sure it worked.

Upgrade process
Note: DO NOT run install.php at any time during an upgrade. It will empty your content from the database.
1.    Update Drupal core, modules and themes to the latest Drupal 6 versions. (Follow best practices here. As usual, you should back up your site and database prior to doing this.)
2.    Backup your existing site and database.
3.    Log in as user ID 1 (the site maintenance user).
This is the user name that you created during the installation process for your site.
4.    Put your site in maintenance mode
Go to the site maintenance page (Administer > Site configuration > Site maintenance). Select "Off-line" and save the configuration. If you have defined a custom maintenance theme in your settings.php file, comment it out before proceeding.
5.    Change all themes to Garland
Go to the Themes page (Administer > Site building > Themes). Enable "Garland" and select it as the default theme. If you have been using a separate theme for administration, select "Garland" for your administration theme as well. You can find the administration theme setting at (Administer > Site configuration > Administration Theme)
6.    Disable non-core modules
Go to the Modules page (Administer > Site building > Modules). Disable all modules that are not listed under "Core - required" or "Core - optional". It is possible that some modules cannot be disabled, because others depend on them. Repeat this step until all non-core modules are disabled.
If you know that you will not re-enable some modules for Drupal 7.x and you no longer need their data, then you can uninstall them under the Uninstall tab after disabling them.
7.    Remove default settings file
On the command line or in your FTP client, remove the file sites/default/default.settings.php
8.    Remove all old core files and directories
remove all old core files and directories, except for the 'sites' directory and any custom files you added elsewhere. If you made modifications to files like .htaccess or robots.txt, you will need to re-apply them from your backup, after the new files are in place.
9.    Remove uninstalled modules
If you uninstalled any modules, remove them from the sites/all/modules and other sites/*/modules directories. Leave other modules in place, even though they are incompatible with Drupal 7.x.
10.    Download Drupal 7
Download the latest Drupal 7.x release to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
11.    Re-apply modifications to core files
Re-apply any modifications to files such as .htaccess or robots.txt.
12.    Make your settings.php file writeable
Make your settings.php file writeable, so that the update process can convert it to the format of Drupal 7.x. settings.php is usually located in sites/default/settings.php
13.    Run the update script
Run update.php. This will update the core database tables.
If you are unable to access update.php do the following:
o    Open settings.php with a text editor.
o    Find the line that says:
$update_free_access = FALSE;
o    Change it into:
$update_free_access = TRUE;
o    Once the upgrade is done, $update_free_access must be reverted to FALSE.
14.    Backup your database
Backup your database after the core upgrade has run.
15.    Upgrade fields
If you were using CCK (and perhaps additional modules) to create fields for your content types, you will need to upgrade the data in those fields as a separate step. Download the Drupal 7 CCK module, and turn on Content Migration. Go to Structure > Migrate Fields for a page to walk you through the migration process. There are now several types of fields in core, but not every type. You might need to download Drupal 7 versions of contributed modules to support other types of fields
16.    Update contrib modules and themes
Replace and update your non-core modules and themes
17.    Check the Status Report
Go to the Status Report page (Administration > Reports > Status). Verify that everything is working as expected.
18.    Make sure setting.php is secure
Ensure that $update_free_access is FALSE in settings.php.
Remove write permissions.
19.    Remove your site from Maintenance Mode
Go to the Maintenance Mode page (Administration > Configuration > Development > Maintenance). Disable the "Put site into maintenance mode" checkbox and save the configuration.

References :  http://drupal.org/documentation/upgrade/6/7

                     

on 21 Aug 2012 by