Simplifying WordPress MU upgrades
Okay, I’ll admit it. I’m really bad about upgrading my WordPress MU install in a timely manner. And that’s a pretty big disservice, especially for others (like my brother) hosted on the same install. So tonight, I put together a new directory structure for my WPMU installation, and with my brother’s help, wrote a wonderful little shell script to handle future upgrades for me.
Originally, I had WordPress MU file sitting in a WPMU
directory. With each upgrade, I’d have to make sure I didn’t disrupt the existing important files (like those in wp-content).
My new structure involves a version-specific directory within the WPMU
folder (eg wordpress-mu-2.6.3
). Alongside that is a directory named const
, to hold all of the files that remain constant between upgrades. Finally, there’s a symlink named current
that points to the current version-specific directory. I then create additional symlinks within this directory back to files and directories in const
.
I’ve attached a sanitized copy of the final script (upgrade-wordpress-mu.sh) for your pleasure. It first checks to make that it’s running as root - my WPMU installation is outside the scope of my home directory, so that’s a necessity. There’s a few more checks to make sure the user has specified a version, and that there’s an archive of the WordPress MU files for that version. Then it goes to town, extracting the files, and symlinking the relevant items in const
. I won’t go into the nitty-gritty, since it’s all pretty self-evident from the script.
If you do choose to use this yourself, just be sure to change the path on line 27 (unless that really is where you want your files).