upgrade

Drupal 7 Upgrades with Scripts and Drush

AutomationA Drupal upgrade between major versions rarely means doing the upgrade procedure once. A new configuration, changing content, or needing to test different module versions typically means redoing the upgrade from scratch a number of times, a tedious, error-prone and time consuming process. Fortunately there's a solution: automation!

Scripting was always possible, but Drush has made it so much simpler. What follows is a review of the Drush commands I used via script to upgrade my Group 42 website to Drupal 7. The hand full of shell commands are basic and covered many other places on the net. The full upgrade scripts are at the end of the post.

If you're familiar with Drush I recommend jumping directly to the scripts.

Drupal File Upgrade Bash Script

Replacing files during a Drupal upgrade can be tedious, especially for those of us who have to worry about SVN files in every directory. The following script automates this part of the Drupal upgrade, making it much faster and less error prone. I've been using the script in its current form for almost a year and it has served me well. And though most of my other bash scripts have been replaced by Drush commands, this script has proven better suited to my workflow than its Drush equivalent.

Overview

The script does the following:

  1. Deletes the current Drupal distribution files while preserving:
    • directories
    • SVN files
    • all files in the /sites directory tree
    • all files in /files directory tree
      (I have a number of sites using the old file directory location)
    • the Komodo (.kpf) project file
  2. Downloads and expands the Drupal distribution tarball if it has not already been done
  3. Copies the new Drupal distribution files to the target directory
  4. Removes the unrequired text files. e.g., CHANGELOG.txt, INSTALL.mysql.txt
Subscribe to RSS - upgrade