I’m taking a break from the non-stop fine-tuning & fixing things after the upgrade to Drupal 5.0 to write a quick post on the steps I took for the upgrade. Even though the upgrade went pretty well, there are still a LOT of little glitches and customizations that need to be done – enough to have kept me busy pretty much all day/night since the upgrade (but all worth it!)
Step One: Decide what version of Drupal to upgrade to
Being on Drupal 4.7 I had to decide if I was going to upgrade to Drupal 5 or Drupal 6. The biggest determining factor was module support – if there were any important/critical modules not supported in either, I couldn’t use that version. I made a list of all of my important/critical modules, then checked what versions were available at Drupal.org. It turns out that several of my favorite/important modules are not yet supported in Drupal 6 so I decided to upgrade to Drupal 5. NOTE: Even if you decided that you want to upgrade to D6, you must first upgrade to D5 – there is no direct upgrade path from Drupal 4.x to Drupal 6.x.
Step Two: Build a test-site to see what breaks
I didn’t want to experiment with the live site so I built a test-environment that I could do the upgrade on and work-out any issues. I could also remove all those old, unused tables in the database without fear of breaking the site. Most webmasters probably already have a test environment but since I’m a maverick (and never really knew how to make a test-site) I didn’t have one. Creating a test-site is pretty easy and boils down to three basic steps:
- Create a duplicate database
- Copy all your files to a new subfolder
- Change your SETTINGS.PHP file to reflect the changes
There is a great post at the Drupal website with all the details for creating a test environment. Even though the instructions in the link above describe doing the steps from the command-line, I was able to use cPanel to create the ‘test’ subdomain, phpMyAdmin for creating and copying the database, my GUI FTP client for copying all of the files to the subdomain, and my GUI FTP client and the text-editor on my PC for modifying the SETTINGS.PHP file. So don’t let that command-line stuff scare you.
Step Three: Once you have your test environment up and running, you are ready to start the upgrade.
Download the new version of Drupal and be sure to read through the install/upgrade steps. Some of the important ones to remember are:
- Log in as “user 1″ (site administrator) and keep that browser-window open before you start the update process
- Disable all non-core and unused modules
- Disable the cache
- MAKE SURE YOU HAVE A BACKUP OF EVERYTHING – FILES AND DATABASE (this wont apply as much since it’s a test environment, but you better be damn-sure you have backups before you touch the real site)
- Make sure you removed ALL of your previous Drupal files/directories and copy the new files ‘fresh’
Now you’re ready to go through the update/upgrade process. There is also a great step-by-step video by Lullabot that’s worth the few minutes it takes to watch that will give you a great understanding of the process.
Step Four: You’re done!
Actually, step-4 is fixing all the things that go wrong. In my case, the very first thing I saw after the update processes completed were these errors:
Warning: _drupal_cache_init(modules/fastpath_fscache/cache.fs.inc) [function.-drupal-cache-init]: failed to open stream: No such file or directory in /home/.../includes/bootstrap.inc on line 932
Fatal error: _drupal_cache_init() [function.require]: Failed opening required 'modules/fastpath_fscache/cache.fs.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/.../includes/bootstrap.inc on line 932
I panicked at first, but after spending just a few minutes with my friend Google, I found that these errors had to do with the old Drupal 4.7 cache. I was able to fix it by removing the “cache_inc” record from the Drupal Variable table:
DELETE FROM drupal_variable WHERE name = 'cache_inc';
Of course, since I am sql commenline ‘tarded, I used phpMyAdmin to delete the record.
I also got some errors that referred to tables that I had deleted and were no longer in use. Unlike the errors above that stopped me from doing anything, the site was still working so no further action was required.
After the upgrade completed it was just a matter of testing everything – viewing different pages, making posts, etc, to see what did and did not work. Most errors that I saw referred to .PHP file customizations that I had made or modules that had not yet been updated/reactivated. After downloading the new module versions and activating them, most of these errors were resolved. Remember that when installing new versions of modules you need to run UPDATE.PHP to upgrade their database tables.
Once I was confident that most everything was working I invited the moderators and some trusted members into the test-site to give things a run-thru. Once it looked like everything was working I was confident to go through the same process on the live-site.
It’s been two days since I upgraded the site and I have found dozens (if not more than 100) minor things that need to be fixed/updated. So far nothing major, but there have been enough to keep me busy from the time I wake up until midnight or so when I fall asleep at the keyboard.
Like I posted the other day, the upgrade to Drupal 5 is well worth it based on the features alone and if you’re still hobbling along on a pre 5 version, you really should upgrade. One of the main reasons I upgraded was because of the “Duplicate entry .. for key 1 query: INSERT INTO sessions” errors that were bring the site to a standstill or crashing the site all together. The bad news about these errors is that since the upgrade to Drupal 5 we’re seeing more of these errors than ever before. The great news is that Drupal skips over these errors without missing a beat – so no more crashing/lagging site (so far) !