Upgrading Multiple Subversion Copies of WordPress With a Script

I run all my WordPress installs as Subversion checkouts. This makes it easier to upgrade since there’s no FTP involved and I can choose when to upgrade as well as to what version. Since I have multiple blogs, I created a script to facilitate an easy upgrade all of them at once when a new version is released.

As a Christmas present to the WordPress community I’m making my script available to the public.

The only requirement is that you’re using subversion to manage your WordPress installs already. Other than that, the script is pretty simple to use, there’s just one line of paths that needs to be updated.

To use this script, start by creating a new bash script on your server:

vi wpupdate.sh

Press “I” to turn insert mode in vim and paste in the following:

#! /bin/bash
# Copyright (c) 2009 Ryan Duff <http://ryanduff.net>
# This script is licensed under GNU GPL version 2.0 or above
#
# This script upgrades (switches) a subversion copy of WordPress to a tagged version of your choice
# List of Current WordPress tag versions can be found at <http://core.trac.wordpress.org/browser/tags>

# Set your paths
paths=(/path/to/install/1/ /path/to/install/2/)

clear

echo WordPress Update Script
echo ------------------------
echo
echo -n "Please enter version number and press [ENTER]: "
read version

for path in ${paths[@]}
do
cd $path
svn sw http://core.svn.wordpress.org/tags/$version/ .
done

Move your cursor up to the paths line and change to match the full paths to your WordPress installs.

Save the file. (Press Esc to exit insert mode. Type :wq and press Enter to save the file and quit vim)

Make the file executable:

chmod +x wpupdate.sh

To run the script type:

./wpupdate.sh

When prompted, enter the version tag you want to update to and press Enter. Current WordPress version tags can be found here.

If you have any questions or problems, feel free to leave them in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.