Upgrading to latest version within Drupal 6

Upgrading to latest version within Drupal 6
Jul 04, 2012

This procedure is intended to help people who like to update their Drupal 6 based site on their own. (Standard disclaimer apply - details below. Basically it means, 'do it at your own risk') :)

Upgrading to latest Drupal6 version can be quite simple really!

Here are the highly simplified steps:

  1. Log in as Admin. (Preferably the main admin - userid = 1).
  2. Replace Drupal files & folders (don't touch the 'sites' folder. And do take a backup before replacing!)
  3. Run 'update.php' and complete the procedure (url will be http: yourdrupalsiteurl/update.php )

That's all!

But reality can be much more complex. Funny thing is, it could take more steps for your site. It all depends on how your drupal site was built. Anyway, here is the way the core Drupal can be upgraded (or rather 'updated' - in Drupal speak!).

The real scenario!

1. Get the latest Drupal 6 version
Download the latest version from http://drupal.org/project/drupal and unzip in your PC.

2. Always login & leave the browser window open before updating core files.
The easiest way to run update.php is to remain logged in as admin 'before' updating the core files. It's not a must, but will be very helpful.

3. Put the site in Maintenancae Mode
While you are replacing the drupal core files, the main site visitors will get this 'Site under maintenance' message instead of facing a broken site.

You can also customize & beautify the way this Maintenance message is on display. Will write on this in another post as here the object is only about upgrading.

4. Remove the right folders
The way your site was built, there can be many more folders & files in main site folder. So just make sure to check & remove only the right folders that belongs to Drupal core. It is always a good practice to have a backup before removing those folders.

As for Drupal 6, the core folders are 'includes, misc, modules, profiles, scripts, themes'. The downloaded version will also have 'sites' folder, but it's best not to remove / replace with new version. The 'includes' folder may have some new files added. So always have a backup & check manually with new version.

Apart from folder, there will also be 15 files (including the .htaccess - a hidden file in linux). It's better to retain the previous .htaccess & robots.txt files and replace all other files. Of these other files, some of them were text files & it's fine if those files were not uploaded.

5. Upload the latest version of deleted folders & files
Upload the core folders. Check 'includes, misc & scripts' folders of backup. If there some new file that were not available in new core folder, please upload them to their respective folders. These might be required by add-on modules & placed there by the developer. Not doing so might break the website functionality.

5. Run 'update.php'
The URL will be your site name followed by '/update.php'. You might have noticed that update.php file is in main folder, This is the one to run.

This file can be accessed only by site admins. Hence the need to log-in before upgrading the site. It will explore the site & show options. You can mostly click the submit buttons and complete the 3-step process.

This script will make any necessary changes in database etc. so always remember to run this after upgrading drupal core or even separate modules.

6. Change from Maintenance Mode to 'Live'.
Once the update.php has run & after checking everything is fine with the site, you can change the site to live. Remember, as an admin, you can always view site pages even if it is on maintenance mode.

Finally, you can visit 'Status Report' (admin > Reports > Status Report) and ensure that your site uses latest Drupal 6 version.