How We Mass Upgrade Blogs

This article will take approx 1 minute to read.

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

Comments

  1. says

    As a guy who had a hand in other parts of the b5 setup I’ll add another note about consistency: Pretty much everything is done by scripts. The comment field has the domain name in it because the account creation routines did it. That way we can use scripts like the mass upgrade one.

    Sean (who does paid consulting on Linux stuff too :) )

  2. says

    I’d like to note that this is really only a part of an ever-evolving picture. Aaron’s done a fantastic job at nudging us towards a more centralized and managed environment and tools like this certainly don’t hurt ;-)

  3. says

    Well, thanks for clearing that up (I wasn’t really hounding, was I?)

    I’m not sure something like this would be suitable for me – at this stage. And, I have no clue what that thing about the comments and domain have to do anything about it, but that’s beside the point. I have two ISPs .. one is on Windows not unix, and the other is a Reseller Account with it’s own issues and individual logins, split among many individual servers.

    Rather than take a crash course in Computer programming, I now see the need ever more to try and join the crowd in influencing WORDPRESS to just include an automatic upgrade!

    Thanks for sharing.

  4. says

    The WordPress philosophy is for the individual blogs and bloggers. Very little is done to assist in Enterprise. That’s not a knock against WordPress. Just that they can’t be all things to all people.

    Microsoft recognized this for a long time now – which is why, among other things, they have Windows XP Home and Windows XP Pro.

    The best chance there is for a WordPress that is gerared to enterprise is a fork.

    We’re content with what we have to do now, so we’re not pushing for a fork. But a fork would be useful as more big businesses running multiple instalations of WordPress come to the forefront.

    For the record, it is difficult for anyone to maintain WordPress on our scale without dealing with systems stuff – that is, getting outside of WordPress immediate.

    Then there is WPMU.