Weblog Archive

Upgrading WordPress with svn

Sun, 23 Mar 2008 at 18:18 | Filed under Noteworthy, Server side

Pre-requisites: You’ll need secure shell access to your host, and your host should have enabled svn client.1

All bets are off if you don’t backup everything—every file, every customization, as well as your database—first. As an added insurance, go to the WordPress admin Dashboard › Manage › Export, and dump an XML export file. Also, deactivate all plugins. I’m saying this because you won’t regret if things go wrong.

Preparing for svn magic (the first time.)

Login to your host like this2:

$ ssh userid@website.com

You’ll be prompted for the password. Key it in and press enter. If you were able to login, then you’d be in the root of your host. This will typically be like the following or something similar:

/home/userid

Type pwd to know where you are. In most cases, you’ll see a path like the above. Navigate to the folder public_html:

$ cd /home/userid/public_html

In some cases, instead of public_html, you’ll see www or html folder. Let us assume in this case, we have a folder called public_html. List the contents of the folder:

$ ls -al

If you see your wordpress installed files and folders here, then this folder is the root of your wordpress installation.

(If you have it installed in a sub-folder like blog—for example, then further navigate to that folder: $ cd /home/userid/public_html/blog)

Copy entire contents of your WordPress installation root into a folder, say, backup—like this at the prompt:

$ mkdir backup
$ cp -R wp* *.html *.txt *.php .htaccess backup/.

Now in WordPress installation root, run this to remove all the existing wordpress files and folders:

$ rm -R wp* index.php xmlrpc.php readme.html license.txt

Installing a new copy of WordPress using Subversion

Now type this command and hit enter:

$ svn co http://svn.automattic.com/wordpress/tags/2.3.3/ .34

This command “checks out” the release 2.3.3 from WordPress stable repository on to your host.5

Now, add all your custom plugins, themes from the backup folder into this checked out release’s wp-content folder. Copy back wp-config.php and robots.txt files from backup folder into the root of your wordpress installation. Note: All this you’ll need to do only once ever.

Upgrading to the latest version

To update your installation, run the following command:

$ svn up

To switch to a newer release, say 2.5 for example—whenever it becomes available in the near future, you’ll only need to run this command—in the root of your wordpress installation—and your WordPress installation will be updated instantly:

$ svn sw http://svn.automattic.com/wordpress/tags/2.5/

To complete the upgrade, run the following in browser’s address bar:

http://yourblogaddress/wp-admin/upgrade.php

Replace yourblogaddress with your actual site address, and your WordPress installation will be updated to the latest release. You may now enable all your plugins back again.

Once you have an svn based install, you’ll only need to the last two steps to upgrade to future latest releases; and it upgrades in seconds!6

There are other posts about installing upgrading WordPress via svn—you might want to refer to, notably these two:

svn rocks. Learn it. Use it. Love it.7

  1. If you have shell access to your web host, you can check this by typing the following at the prompt and enter: svn --help. If it spits meaningful information, then you’re good to go. Dump those sad hosts that don’t provide you with these basic features. []
  2. userid and password would be same as those you’d use while using FTP; Replace userid and website.com with your actual userid and your website address. []
  3. The period at the end is mighty important, or else you’ll end up downloading all the files at a folder named 2.3.3. Presumably you wouldn’t want this. []
  4. If you prefer the latest “bleeding edge” version, then use the trunk address instead: svn co http://svn.automattic.com/wordpress/trunk/ . []
  5. Think co as in checking out your shopping cart at a free counter. up and sw are like the store home-delivering you product improvements—again for free. []
  6. Notice that in this entire process, we have barely used three commands that are needed to upgrade your actual installation, while much of rest is first-time preparation, and a couple of precautionary measures. Once you get the process, you can see how dumb, and disturbingly simple this is in installing/upgrading WordPress! []
  7. With apologies to Mark Pilgrim. []

, ,

[ Ads ]

Related posts

Following list is auto-generated, based on this post's context as possibly related. You may, however, occasionally find some in this list unrelated, but nevertheless, we sincerely hope that you'll enjoy them too.

Respond privately

Comments are closed, but you may respond privately to “Upgrading WordPress with svn.” (Your response will not be published.)