WordPress Upgrade Script

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 Comments

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

Leave a Reply

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