Upgrading a old/funky Drupal site
Other resources
Upgrading from Drupal 5.x to Drupal 6.x is less streamlined and more thorough. This guide takes you through the very basics, and uses Drush to control the site primarily.
Grab the site source code and database
You'll first need to set up a Drupal environment on your local machine with the original site's source code and database.
Create a directory in /var/www/ and copy the source over:
# mkdir /var/www/sitename-upgrade # cp -Rp /path/to/source /var/www/sitename-upgrade
Now, create a database:
# mysql mysql> CREATE DATABASE sitename_upgrade; mysql> GRANT ALL PRIVILEGES ON sitename_upgrade.* TO 'sitename_upgrade'@'localhost' IDENTIFIED BY 'paSsw0rd'; mysql> \q
Pull in your database dump:
# mysql sitename_upgrade < /path/to/db_dump
Now edit /var/www/sitename_upgrade/sites/default/settings.php (or any other applicable settings files) to reflect your new database credentials.
See if things are working by visiting http://localhost/sitename-upgrade in your web browser. You should see your funky old site.
Note: It helps that we've prepped the database for transfer by truncating the cache tables and search index.
Use Drush to upgrade the old site
This guide is designed for upgrading from Drupal 5 to 6. You will need to wash, rinse, and repeat if you are starting from 4.7, but the procedure is (mostly) the same.
# cd /var/www/sitename_upgrade
Disable old theme
Run drush status theme to determine the theme you are running:
# drush status theme Default theme : themename Administration theme : garland
Take note of the theme names. Garland is a stock Drupal theme, and should be safe to use for the upgrade. Run the next command to reset Drupal to use Garland.
# drush vset theme_default garland # drush vset admin_theme garland # drush dis themename
Reload the page. Minty blue!
Run Drupal upgrades
Make sure you have Update Status.
# drush dl -y update_status # drush en -y update_status
Update Drupal!
# drush up
You'll need to save some information for later at this point:
# drush pm-list | grep Enabled CCK Content (content) Module Enabled CCK Fieldgroup (fieldgroup) Module Enabled CCK Node Reference (nodereference) Module Enabled CCK Number (number) Module Enabled CCK Option Widgets (optionwidgets) Module Enabled CCK Text (text) Module Enabled CCK User Reference (userreference) Module Enabled Core - optional Blog (blog) Module Enabled 5.22 Core - optional Blog API (blogapi) Module Enabled 5.22 Core - optional Color (color) Module Enabled 5.22 Core - optional Comment (comment) Module Enabled 5.22 Core - optional Contact (contact) Module Enabled 5.22 Core - optional Help (help) Module Enabled 5.22 Core - optional Menu (menu) Module Enabled 5.22 Core - optional Path (path) Module Enabled 5.22 Core - optional Search (search) Module Enabled 5.22 Core - optional Statistics (statistics) Module Enabled 5.22 Core - optional Taxonomy (taxonomy) Module Enabled 5.22 Core - optional Upload (upload) Module Enabled 5.22 Core - required Block (block) Module Enabled 5.22 Core - required Filter (filter) Module Enabled 5.22 Core - required Node (node) Module Enabled 5.22 Core - required System (system) Module Enabled 5.22 Core - required User (user) Module Enabled 5.22 Core - required Watchdog (watchdog) Module Enabled 5.22 Event Basic event (basicevent) Module Enabled $Name: DRUPAL-5--1-0 $ Event Event (event) Module Enabled $Name: DRUPAL-5--1-0 $ Image Image (image) Module Enabled Image Image assist (img_assist) Module Enabled Other Google Analytics (googleanalytics) Module Enabled User Interface jQuery Update (jquery_update) Module Enabled User interface Wysiwyg (wysiwyg) Module Enabled Other garland Theme Enabled
These are your enabled themes and modules.
Any non-core module must be disabled:
# drush dis content fieldgroup nodereference number text optionwidgets userreference basicevent event image img_assist googleanalytics jquery_update wysiwyg update_status
Create a new Drupal 6 target
There's a site-upgrade command provided by Drush, but it only works for Drupal 6 and above. Whoops!
But it isn't hard to work around. Get the latest version of Drupal 6:
# drush dl drupal --drupal_project_rename=/var/www/sitename-d6
Edit /var/www/sitename-d6/sites/default/settings.php to match your database credentials and set $update_free_access_check = TRUE; (EXPAND THIS)
Visit ` http://localhost/sitename-d6/update.php' in your browser.
If the site looks crazy, fear not!
First, go to the new site directory:
# cd /var/www/sitename-d6
At this point, for some reason, you will probably have to do this before you will see the proper theme in your browser:
# drush en garland