Introduction
CSE-specific notes to upgrade a Drupal6 site to Drupal7.
Prepare the Existing Production Site to be Upgraded
Create a Development Copy of the Drupal Site
- Create an empty database to house the new Drupal7 site:
mysql> create database drupal_SITENAME_7;
- Switch the theme to Garland, which exists across versions. The customized theme you've probably applied to your site probably won't work in the upgraded site until you've applied a lot of customization.
- Note custom and locally-installed modules that are enabled in Drupal6 and need to be recreated in the Drupal7 site. Determine appropriate upgrade steps for each module. This page shows modules moved into the Drupal7 core, so they don't need to be installed:
http://drupal.org/node/895314
- Offline the production Drupal6 site to freeze the database.
- Dump the production Drupal6 version of the SITENAME database:
% mysqldump -u readonly_user -p***** drupal_SITENAME > drupal_SITENAME.`date +\%Y\%m\%d`.sql
- Restore the SITENAME database dump to the empty SITENAME_7 database:
% mysql -u root -p drupal_SITENAME_7 < drupal_SITENAME.20110520.sql
- Grant the database user privileges over the SITENAME_7 database:
mysql> grant all on drupal_SITENAME_7.* to 'drupal_SITENAME'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Recreate Admin User (UID 1) Credentials
- Perform admin tasks as UID 1 until you have your personal account and permissions restored. Update UID 1's password to comply with Drupal7's upgraded password hashing mechanism. Generate the password hash:
% cd /usr/local/www/drupal7/
drupal7% ./scripts/password-hash.sh 'MYPASSWORD'
password: MYPASSWORD hash: $S$DKQdnqSQRDxR9SIQ7f1mi6Pl3BznmOZMZBf7vRSBsx580eLT/9Gn
[postel] drupal7%
- Now update UID 1's password with that password hash:
mysql> update users set pass='$S$DKQdnqSQRDxR9SIQ7f1mi6Pl3BznmOZMZBf7vRSBsx580eLT/9Gn' where uid=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Prepare the Development Drupal7 Site
- Create the Drupal7 site directory location:
[postel] % cd /usr/local/www/drupal7/sites/
[postel] sites% sudo mkdir wiki.cse.buffalo.edu.SITENAME_7
[postel] sites% sudo chown www wiki.cse.buffalo.edu.SITENAME_7/
- Copy the default Drupal6 configuration file to the Drupal6 site directory:
[postel] sites% cd wiki.cse.buffalo.edu.SITENAME_6/
[postel] wiki.cse.buffalo.edu.SITENAME_6% sudo cp -p ../default/settings.php .
- Edit the configuration file's $db_url value to point to the SITENAME_6 database:
[postel] wiki.cse.buffalo.edu.SITENAME_6% sudo chmod 644 settings.php
$db_url = 'mysql://USERNAME:PASSWORD@localhost/DATABASE';
[postel] wiki.cse.buffalo.edu.SITENAME_6% sudo chmod 444 settings.php
- Copy over the files directory, if it exists.
- Copy over any custom or local themes, if they exist.
- Create Site URLs for the Archive Site and the Development Site:
% cd /wikis/root
[postel] root% sudo ln -s /usr/local/www/drupal5 SITENAME_5
[postel] root% sudo ln -s /usr/local/www/drupal6 SITENAME_6
Upgrade the Development Drupal6 Site
This is where the magic happens.
- In the settings.php configuration file, set $update_free_access = TRUE;:
- From the web, run the Drupal6 update.php script:
https://wiki.cse.buffalo.edu/SITENAME_6/update.php
- Check the Status Report. Fix problems that it describes.
- Enable the 'Update Status' Module.
- Grant authorized 'User management' -> 'Permissions' to 'Access Site Reports'.
- In the settings.php configuration file, set $update_free_access = FALSE;
- chmod 444 the configuration file.
- Install Drupal6 versions of cusstom and locally-installed modules, perhaps including: views, token, pathauto, upload path, taxonomy access control (TAC), Securepages, Filter Default, LDAP, fasttoggle.
Cutover
Preserve the Drupal5 site data
- Change the Drupal5 site name to have a live archive of the Drupal5 site:
[postel] % cd /usr/local/www/drupal5/sites
[postel] sites% sudo mv wiki.cse.buffalo.edu.SITENAME wiki.cse.buffalo.edu.SITENAME_5
- Update the database name in the configuration file, settings.php:
- Leave the Drupal5 SITENAME archive offline. It shouldn't be accessible to the public, but it should be available if you need to downgrade the SITENAME site.
Enable the Production Drupal6 site
- Dump the Drupal6 version of the site:
[postel] backups% mysqldump -u readonly_user -p***** drupal_SITENAME_6 > drupal_SITENAME_6.`date +\%Y\%m\%d`.sql
- Drop the existing production database, recreate an empty version of it:
mysql> drop database drupal_SITENAME;
Query OK, 54 rows affected (0.01 sec)
mysql> create database drupal_SITENAME;
Query OK, 1 row affected (0.00 sec)
- Restore the development Drupal6 version of the site to the production database:
[postel] backups% mysql -u root -p drupal_SITENAME < drupal_SITENAME_6.20110520.sql
- Change the Drupal6 site name:
[postel] % cd /usr/local/www/drupal6/sites/
[postel] sites% sudo mv wiki.cse.buffalo.edu.SITENAME_6/ wiki.cse.buffalo.edu.SITENAME
- Change the Drupal6 configuration file, settings.php to point to the production database.
- Enable the production URL to point to our Drupal6 content:
[postel] % cd /wikis/root
[postel] root% sudo rm SITENAME
[postel] root% sudo ln -s /usr/local/www/drupal6/ SITENAME
[postel] root% sudo rm SITENAME_6
- Online the production site.
- Configure LDAP settings to remove the password change field, if this site relies on LDAP authentication only (that is, if people external to UBIT can't create and manage accounts).
- Compare the Drupal5 and Drupal6 sites. You may need to fix some views to synchronize them.
- postel:/usr/local/share/doc/drupal7/UPGRADE.txt
- http://drupal.org/upgrade/
- http://drupal.org/node/1072940