WordPress Upgrade Script

March 12th, 2006 | Jeff Boulter | General

WordPress (the software that runs this blog) was recently upgraded to fix some security issues. I loathe updating WordPress because it’s such a manual process. Copy this here, check that, download this, blah blah blah. It doesn’t help that the instructions are mostly written for people who only have FTP access to their web hosting accounts.

I was sufficiently annoyed today to write a script for the power user to upgrade wordpress. I successfully upgraded from 2.0 to 2.0.2 with it, but I don’t guarantee that I won’t blow up someone else’s blog when used.

echo "you disabled all plugins, right?"

rm -f wpbackup.tgz
rm -f latest.tar.gz
rm -rf wptmp

echo "enter mysql password"
mysqldump --add-drop-table -u boulter -p wordpress > wordpress/wordpress.sql
tar -cpzvf wpbackup.tgz wordpress/
# just in case we really break things, we have a full backup
cp wpbackup.tgz wpbackup`date +%Y%m%d%H%M%S`.tgz

mkdir wptmp
cd wordpress
cp wp-config.php .htaccess ../wptmp
cp -R wp-content ../wptmp

# extra directories I use
cp -R archives ../wptmp
cp -R maillist ../wptmp

cd ..
rm -rf wptmp/wp-content/cache

wget http://wordpress.org/latest.tar.gz

rm -rf wordpress
tar -xzpvf latest.tar.gz
cp wptmp/.htaccess wordpress/
cp -R wptmp/* wordpress/
rm -rf wptmp

echo "now go upgrade at wp-admin/upgrade.php"

I feel better now.



4 Responses to “WordPress Upgrade Script”

  1. Petersen-net.de » Blog Archive » WordPress Upgrade Script Says:

    [...] Hier geht es zum WordPress Upgrade Script [...]

  2. Mark Says:

    mysqldump –add-drop-table -u boulter -p wordpress > wordpress/wordpress.sql

    I sure hope you have obfuscated your real pass for mysql

  3. Jeff Boulter Says:

    the ‘wordpress’ after -p is the database name, not a password.

  4. Marc Says:

    I just stumbled on an easier way to update WordPress easily - Subversion!

    http://marc.abramowitz.info/archives/2006/04/22/updating-wordpress-via-subversion/

Leave a Comment