Upgrading WordPress using Subversion
I just love it. It’s so easy and simple. Much simpler than having to deal with tar-balls (or ZIP files). There are no worries that extracting the archive will overwrite custom files and no worries that old, stale files will be left behind. It’s all taken care of automatically. On top of everything else it’s much faster, too, because the amount of data that needs to be downloaded is so much less. Only code that actually changed is transferred, not the whole thing all over again.
Of course, one needs shell access to the server that has Wordpress installed for this to work — and a Subversion client. Also, Wordpress needs to be installed from Subversion (rather than a ZIP or TAR archive) in order to use Subversion to upgrade later on. Luckily, there is a nice article about Subversion and Wordpress that describes how this can be done.
Once everything is in place, upgrading is a single-command procedure. Subversion will take care of removing old files, creating new files and updating those that changed.
Verify the current version:
$ svn info
Path: .
URL: http://svn.automattic.com/wordpress/tags/2.0.9
Repository Root: http://svn.automattic.com/wordpress
Repository UUID: 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Revision: 4914
Node Kind: directory
Schedule: normal
Last Changed Author: ryan
Last Changed Rev: 4898
Last Changed Date: 2007-02-20 11:57:45 -0800 (Tue, 20 Feb 2007)
The actual command to upgrade (a one-liner):
$ svn switch http://svn.automattic.com/wordpress/tags/2.0.10
U wp-login.php
U wp-comments-post.php
U wp-includes/default-filters.php
U wp-includes/template-functions-general.php
U wp-includes/template-functions-category.php
U wp-includes/links.php
U wp-includes/functions-formatting.php
U wp-includes/version.php
U wp-includes/functions-post.php
U wp-includes/classes.php
U wp-includes/template-functions-links.php
U wp-includes/pluggable-functions.php
U wp-includes/comment-functions.php
U wp-includes/functions.php
U wp-includes/registration-functions.php
U wp-includes/template-functions-author.php
U xmlrpc.php
U wp-trackback.php
U wp-admin/edit-comments.php
U wp-admin/post.php
U wp-admin/upgrade.php
U wp-admin/admin-functions.php
U wp-admin/bookmarklet.php
U wp-admin/admin-db.php
U wp-admin/import/livejournal.php
U wp-admin/import/dotclear.php
U wp-admin/import/mt.php
Updated to revision 5176.
There were only updated files (note the ‘U’) in this case, no added or deleted files (those would show as ‘A’ for added or ‘D’ for deleted).
Now, we verify that we actually have the new version:
$ svn info
Path: .
URL: http://svn.automattic.com/wordpress/tags/2.0.10
Repository Root: http://svn.automattic.com/wordpress
Repository UUID: 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Revision: 5176
Node Kind: directory
Schedule: normal
Last Changed Author: ryan
Last Changed Rev: 5174
Last Changed Date: 2007-04-03 11:14:52 -0700 (Tue, 03 Apr 2007)
Looks like it.
Update the database:
All that’s left to do is go to the admin pages to see if WordPress wants to update the database. This may happen if the database format was changed for the new release. If an update is required, WordPress will say so automatically. If not, the regular admin pages will appear — together with the new version number in the page footer.
Done.
Of course, it’s always a good idea to make a backup of the WordPress directory and the database before attempting to upgrade. Even if it’s simple, things can go wrong.
Comment by Chris Guld
April 10, 2007 @ 13:22
Hello Markus … You left a comment on my blog, ‘www.wifisavvy.com’ this afternoon about Kbps being Kilo*bits* where I had written Kilo*bytes*. You’re absolutely right, and I immediately edited the post - simply changing those couple of letters. When I saved and took a look, the last 3/4 of my post were gone. It appears that I selected and deleted most of my post before clicking the save button. I swear I didn’t, but there’s not much good in swearing. I’m writing you in hopes that you read my post from an rss feed and may, perchance, have the complete text that you could email me.
Then - I need to figure out how to get my posts emailed to me, or backed up somehow, so this doesn’t happen again.
THANX!