Installing and Updating WordPress via SVN

I have quite a few WordPress installations that I semi-manage on my server, and just recently realized how time consuming it is everytime a new version comes out.   WordPress does let you update it to the newest version directly from the admin interface which is definitely nice, but if you have several installations of WordPress you aren’t going to want to log in to every single one of them and click that update button.

One solution, and the one I decided on for now, is to use Subversion.   Ever since 1.5, WordPress has been using subversion for its version control so of course they allow public read-only access to the subversion repository.   Whether you are already familiar with subversion or not, it is relatively easy to install WordPress using svn and then keep it up to date as well.

Here’s an example on my server:

$cd /var/www/vhosts/testdomain.com/httpdocs/
$svn co http://core.svn.wordpress.org/tags/3.0 .
.....svn will download the 3.0 branch of wordpress to the current directory ...

Be sure to include the period at the end of that svn checkout command so that it downloads wordpress to the directory you’re in. Otherwise it will create a new directory named 3.0. Once Subversion finishes checking out the branch, and assuming your permissions are all good then you can just go to http://testdomain.com/ and run the WordPress install script to put in your database info and whatnot. You could also modify wp-config.php manually if you’re into that.

And to upgrade wordpress?    Easy!   You just need to switch the branch subversion has checked out currently.

$cd /var/www/vhosts/testdomain.com/httpdocs/
$svn sw http://core.svn.wordpress.org/tags/3.0.1/ .

It will update all the files that need to be updated. Depending on the release, you’ll probably need to go to http://<wordpress install>/wp-admin/upgrade.php once the files are updated.

Now with this, you could create a bash script to loop through all of your wordpress installation directories and run the svn switch command to update to the latest stable wordpress branch.    You can find a list of the current available branches here: http://core.svn.wordpress.org/tags/

Tags: , ,

Leave a Reply