WordPress upgrade with svn sw

Most likely, it’s time to upgrade your instance of wordpress (given their releases are every couple weeks). The new built-in automatic upgrade works if you make your blog owned by the apache user, but if you have any local changes, they get blown away by the upgrade. If you use subversion, your changes stay AND you get the security patches. To install via subversion, first follow these steps.

Before you upgrade, always backup your database and blog code:

mkdir -p ~/.archive
mysqldump --opt blog | gzip > ~/.archive/blog-$(date '+%Y%m%d').sql.gz
cd ~/public_html 
tar czf ~/.archive/blog-$(date '+%Y%m%d').tgz blog

Then upgrade. Note that switching from 2.7.1 to 2.8 isn’t just a “svn switch” — you must svn update first.

cd ~/public_html/blog
svn update
svn sw http://svn.automattic.com/wordpress/tags/3.0.3/

The next time you hit the wp-admin page, it will upgrade the db and you’ll be done.

Note that if you see

svn: 'http://core.svn.wordpress.org/tags/2.8.6'
is not the same repository as
'http://svn.automattic.com/wordpress'

you should use this svn sw command instead:

svn sw http://core.svn.wordpress.org/tags/3.0.3/

  • Update November 15, 2008: 2.6.5 is out. See installing wordpress using subversion.
  • Update December 14, 2008: 2.7 with new admin UI hotness
  • Update June 15, 2009: 2.8 requires an `svn update`
  • Update July 9th, 2009: 2.8.1
  • Update July 22nd, 2009: oye, 2.8.2
  • Update Aug 4th, 2009: oye, 2.8.3
  • Update Aug 17, 2009: 2.8.4
  • Update Oct 20, 2009: 2.8.5
  • Update Nov 15, 2009: 2.8.6
  • Update Jan 2010: 2.9.1
  • Update March 2010: 2.9.2
  • Update July 2010: 3.0
  • Update Fall 2010: I give up. It’s easier to just use the wordpress upgrade system, even though it deletes your changes.
  • Related posts:

    1. Left outer joining a has_and_belongs_to_many in a Rails 3 scope
      Winner for esoteric rails 3 question, but the googles (and stack overflow and the rails docs) all failed me. Here’s the pretty simple scope syntax for finding posts with or......

    • http://www.maimax.com maimax

      Great, thanks! ^_^