Making sure WordPress is up-to-date

For anyone that has to manage many (any?) WordPress instances, keeping it up to date can be a real PITA. (I don’t expect WP to ever have an SSH vs FTP based auto-update).

The best way to make life a little easier is to move over to using svn tagged versions. Then you can simply switch over the next time a security vulnerability is patched with a simple ‘svn’ switch.

Here’s some simple bash-ness that’ll help you know when to upgrade. In *theory* you could run this on cron and have it auto-update, but I’m assuming that if there’s a DB schema update required, you’ll need to watch over it, so probably not something you want to run on production without some verification:


installed_version=`svn info $yourwp | grep URL | cut -f 2 -d' '`
current_version=`/usr/bin/lynx --dump --nonumbers http://core.svn.wordpress.org/tags/ | tail -n 2 | head -n 1`

if [ installed_version != current_version ]; then
  # this is where you could get fancy and do an svn switch and update
  echo `date` | mail -s "WP is out of date!" yourmail@example.com
fi