How I manage my Wordpress

27 Nov 2007

Apparently, Wordpress is famous for its 5 minute install procedure, and claims upgrading Wordpress is even easiier. And to be fair, it is a reasonably straightforward three (four?) steps:

  • Step 0: Before You Get Started: Backup and deactivate plugins.
  • Step 1: Replace WordPress files: Extract the new tarball over your existing installation. With special notes about what files you need to be careful to preserve.
  • Step 2: Upgrade your installation: Hit your wp-admin/upgrade.php URL, which nicely upgrades your DB.
  • Step 3: Do something nice for yourself.

My problem is I'm always, always recalcitrant in upgrading Wordpress, because I cannot help but shirk at Step 1. Have I preserved the correct files (I have a whole lot of custom static content that sits alongside Wordpress)? Did I make any changes anywhere that I need to keep (I once change a core Wordpress file to work around a bug)? How do I even tell if I've accidentally overwritten the wrong file? And at about this stage it gets thrown into the too-hard basket, to be retried next weekend.

But not anymore!

Thanks to funionfs I no longer have first-step fear. And while some of you may think that fiddling with /etc/fstab and yum is a level of complexity well beyond Step 1, I can honestly say that this is what I consider an elegant solution.


funionfs is a union filesystem, and sits on top of FUSE (Filesystems in Userspace).

A union filesystem is something I've pondered the existence of before (and trust Ivan to know exactly what I wanted). They allow you to fold up a set of separate directory trees and have them appear as one. One of the directories is usually read-write (with copy-on-write), while the others are read-only.

I recently moved to a new FC8 box, and low and behold -- sudo yum install funionfs just worked!

What's in my docroot?

I have a reasonable chunk of static content (images, flash animations, software archives, movie downloads, etc) that I keep in a Subversion repository and deploy to this website via rsync. This content existed before I started using Wordpress, and will exist if I ever stop using Wordpress, so it is not appropriate content for Wordpress to own.

I have Wordpress, which is a whole bunch of .php and what-not.

I have my all my files that sit on top of Wordpress. My wp-config.php config file, the .htaccess file that Wordpress generates so my URLs look cool, some plugins and my theme. It is these files that cause my Step 1 fears. (And in fact, these fears prevent me from making some much needed changes to my theme, too).

All these files, with their different sources and different life-cycles used to be clumped into the one scary directory.

What's where now?

Now, I have three different directories:

  • /home/matt/ My rsync-ed static content.
  • /home/matt/ An extracted wordpress-2.1.tar.gz with no modifications.
  • /home/matt/ my Wordpress config, plugins, themes, etc.
  • /home/matt/ An empty directory.

After a bit of fiddling with funionfs options, I settled on a mount like this:

sudo funionfs -o dirs=\
 NONE /home/matt/

After running that, wordpress_all contains exactly what Wordpress wants to see: a big mishmash. Any writes Wordpress makes (e.g. to configuration or .htaccess) get written through to wp_data. Each time I rsync my static content to static it is automatically visible in wordpress_all. And as you will see below, upgrading is a scream.

To ensure this union mount exists next time the box reboots, I converted the above funionfs instruction into an /etc/fstab entry:

funionfs#/home/matt/ /home/matt/ fuse rw,nosuid,nodev,allow_other,dirs=/home/matt/ 0 0


Having set that up, it was now time to finally upgrade from Wordpress 2.1. This is what it looked like:

$ cd ~/
$ wget
$ tar fvxz wordpress-2.3.1.tar.gz 
$ mv wordpress wordpress-2.3.1
$ sudo vi /etc/fstab
$ # change the line to refer to wordpress-2.3.1 instead of wordpress-2.1
$ sudo umount /home/matt/
$ sudo mount funionfs#/home/matt/
$ sudo /etc/init.d/httpd graceful   # for good measure
$ # hit upgrade.pgp in my browser

Do you know how happy that made me?

Next steps

I'm thinking of making the static and wp_data directories Subversion workspaces (checked out directories). I can then version control my Wordpress config. And by being able to remotely edit my theme and check it in (and check it out on a test Wordpress server) I'm finally likely to make some changes.

  • Home
  • Blog