How We Mass Upgrade Blogs

I’ve been getting hounded for some time about how we manage mass upgrades at b5media. It makes no sense to tackle things like you might upgrade, say 1, blog. Download. Unzip. FTP. Upgrade. It’s fast, but not when you have over 20 blogs. So I’m releasing our (slightly modified) script for public consumption.

Remember, our methods work because we are consistent. We manage consistently. We centralize when possible. We use Subversion. We have standard naming conventions. We use standard practices. Because we are consistent, our methods work. Your mileage may vary. Depends on how consistent you are.

This script assumes two things. It assumes that the comment field of each unixaccount is a normalized domain name. That is

1
example.com

– no slashes. No www. no http://. Just the top level domain. This is a discipline thing and requires making sure each new account is assigned a domain. If a user account does not have a domain, add it with

1
usermod -c example.com user

where example.com is the domain and user is the unixaccount.

It also assumes that the admin has a centralized database somewhere that can be tapped into for the blog urls. I’ll leave you to your own devices on this one. The script also requires PHP with cURL and the script must be run from the command line interfact (CLI) so the script must be owned by root and have owner execution permisions.

Other than that, have at it. This is not supported in any way shape or form and my releasing it here is merely to fill a request. I will not support this. Period. Consider it for your academic uses. :)

I am available for paid consulting though.

Source Code

Update: The source code has been updated. Notably, I’ve learrned a new trick. That is reading in user input from the command line in PHP. So now, the script prompts for revision number of WordPress. If a revision number is given, the blogs are upgraded to that number. If not, it defaults to trunk. Also, I moved the SVN magic out of a shell script and into this script. It also adds a timer so I can stop looking at the clock. ;)

1
2
3
[root@b5media-db2 ~]# ./wpup.php
What WordPress Revision? (default TRUNK)  4731
Upgrades completed in 4 minutes and 54 seconds

Read More