Upgrading From Old pre-4.6 Drupal Releases To 4.7

Some Drupal site owners, for various reasons, do not stay up to date on Drupal releases. As release after release come out, they lag more and more behind. Old releases not only lack new functionality, but can have security issues that can be exploited by hackers.

Site owners who lag behind are faced with a formidable task. The reason is that 4.7 only has support for upgrading from 4.6 only, but not older releases.

Of course, there is always a way to do this.The following article is based on recent work we did for a a client who asked me to upgrade his old 4.3.1 install (from end of 2003!)

It is very important that you do this on a test server first, and not on the live machine. If you do it on a live install, then at least backup the directory Drupal is in as well as do a database dump before you start.

Upgrade to 4.5 first

We will need an interim upgrade to 4.5 release, which can handle upgrades from 4.0.0 onward. Note that at the time of writing, the 4.5.0 release is available today on Drupal.org, but this may change in the future. The method detailed below should work regardless whether old tar balls are available or not.

Using CVS To Access The Repository

First, you have to have a CVS client to be able to access Drupal's repository. To do this, use the following commands:

cd public_html
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-4-5 drupal
mv drupal drupal45

The above assumes that the directory public_html is your DocumentRoot of your Apache server.

Run the 4.5 update.php

Now, edit the file drupal45/sites/default/settings.php and change it to point to the database that you loaded from the old Drupal installation, and a suitable $db_url (e.g. http://example.com/drupal45).

Now, login as admin to the site, and then point your browser to http:// example.com/drupal45/update.php. Proceed with the update normally.

Update to 4.7

After this is complete, you will be up to date and ready for an upgrade to 4.7.

Proceed to install Drupal 4.7 normally, and run the update.php from that release.

Do not forget to delete the drupal45 directory, since you do not want an old release accessible to the outside world.

It would be a good idea to dump the database after the upgrade to 4.5, just in case you need to go back to that version.

Copy To The Production Server

After you are done, you can copy the drupal files and the database dump back to the live server.

Contents: