After many attempts and learning curves I managed to update my Drupal site which was originally built in Drupal 5 to Drupal 7. Due to the my learning curves, late nights and lots of backing up my data and database, I would like to share with you how I managed to update my site that has many contributed modules, had been updated numerous times and to also congratulate Drupal and it community on how future proof Drupal really is.
Firstly I upgraded the site from Drupal 5 to Drupal 6 - this proved easy enough. All my contributed modules were available for Drupal 6 and the update process was as simple as running update.php for each module. At this point I thought what all the commotion was on upgrading from one major version to another..... I could not have been more wrong!
I started by following the Drupal documentation on how to update from Drupal 6 to Drupal 7 - http://drupal.org/node/570162 - After reading this, a few times, I decided to go ahead. I ensured all my contributed modules were up to date to the latest recommended version, Drupal core was also updated and as we should do, I backed up the files a database at this point. I then took the site offline, (though I guess this is not too much of a problem, if at all, because I was running a backup of my live site on my local machine), disabled all non core modules, disabled all themes except Garland, and set Garland as the only enabled and default theme. .
I continued by deleting all the files inside my Drupal installation whilst keeping the "sites" folder in place. I then navigated to: /sites/default and removed the default.settings.php file but kept my settings.php file in place. I then navigated back to the Drupal installation folder and copied the new Drupal 7 files into it. Job done I thought, I then went to my browser and navigated to /update.php and hit enter! At the point of hitting enter I thought, I wonder how long this update will take?
Well, what happened you ask? Nothing! I had error after error appear in front of me and it was at this point I thought, well actually I will not mention my thoughts but I guess you get the idea. As I was very aware that if you attempt an update like this and it fails, 9 times out of 10 you need to start again. What I mean by this is you need to revert to your backup before your attempted the update. So I deleted the files and database from my local server and reverted to my back up. 10 minutes later when I had re imported my database backup and files I checked everything again.
1) Modules up to date? Check ✔
2) Drupal core up to date? Check ✔
3) Site off line? Check ✔
4) Disabled all non core modules? Check ✔
I then browsed around my site and it's content at this point, for piece of mind on my part here, I then navigated to /admin/reports to check everything, according to Drupal, was all in order. At this point everything seemed to be as it should. I then, in true Drupal form, backed up the files and database again.
Right! I thought, I must have missed something last time so hear we go again!
1) Remove default.settings.php in sites/default/ directory, check ✔
2) Remove all files from my installation directory but leaving the "sites" folder in place. Check ✔
3) Copy the new Drupal 7 files into my Drupal installation directory, Check ✔
I then navigated to /update.php in my browser and never guess what? Well, if I mentioned the error messages, I once again had to endure, I would not have time to tell you how I eventually upgraded to Drupal 7. It was at this point I went to bed!
Thank you Google!
After opening the screen grab of the errors I received and reverting to my last backup, as most of us do for so many things in our daily lives, I turned to Google. After doing many Google searches on the many errors that had appeared I happened to came across this Drupal module - http://drupal.org/project/schema - The Schema module does many things but for me it did two very important jobs. It gave me a list of unwanted / unused tables in the database and a list of errors in the structure of some of my database tables.
I must say due to the age and how many updates my site had had over the years the lists were fairly large! At this point I did not know any other reason why my site would not update to Drupal 7 so I spent the next few hours manually cleaning and repairing errors in my database within phpmyadmin. After quite a few hours, not knowing if I have achieved anything other than cleaning and reducing the size of my database, (which in fairness was well over due) if this would actually do anything at all.
Well, I navigated back to my site, checked everything out, reports etc, all seemed in good order, the database size was reduced from over 100mb to just over 20mb and the site was much faster too! I then backed up my files and database again and repeated the update process again. Guess what, it worked!! All the updates ran through, it took around 30 minutes on my local machine and all the while I was expecting the progress bar to stop or worse still receive some unwelcome errors, but no! the progress bar got to 100% and successfully upgraded to Drupal 7.
I spent many hours in the Drupal community searching many different errors and for me it was simply a set of database tables with problems and old Drupal 5 tables no longer needed. Without the Schema module I do not think I would have got to the bottom of the issues myself and would not have known about the database problems let alone know what tables to drop that would not kill my site, thank you Schema! and thank you Google!