While WordPress has finally added core update in its latest 2.7 branch, there are still people out there that will need to update multiple blogs quickly, and if you are managing your blog installations with Subversion, you can go through and update them all very quickly.
Of course, to update multiple blogs, you’ll have to go through to each folder, run the proper Subversion command, and then move onto the next folder. This can be a time consuming process if you have more than five or six blogs to do for each release.
I have previously written a post on Geeks are Sexy about updating WordPress blogs with Subversion. Read that first if you aren’t using Subversion.
Bash Script
The easiest way to help automate simple tasks on a Linux web server is to Bash script it. This is a very simple scripting language that allows you to do commands and using simple looping and an array, you can quickly do those commands multiple times for multiple blogs.
When I was working for Bloggy Network, I used a similar script to upgrade upwards of forty WordPress powered blogs in less than five minutes.
The following script assumes that your blogs are all in sub-folders under where this script will be placed. If the blogs are in different locations, make sure to include that in your path determinations either when you assign array values or as another variable you can make use of.
[code]
#!/bin/bash
blog[1]=foldername1
blog[2]=foldername2
blog[3]=foldername3
for a in 1 2 3
do
echo “Giving ${blog[$a]} an Upgrade”
cd ${blog[$a]}
svn sw http://svn.automattic.com/wordpress/tags/2.7.1 .
cd ..
done
exit 0
[/code]
This code basically creates an array, and then cycles through the array, going into each folder, and switching the blog to the latest version of WordPress. The only editing you’ll need to do to before using this script is change the blog variable, and change the tagged version number in the svn sw command. If you are using trunk, you don’t have to do this and instead of /tags/version.number you’d just put /trunk.
While I don’t recommend running on trunk, especially for your production blogs, I know many people that do.
If you add more items to the array, you have to make sure that you add more numbers to your for loop. So if there were ten items in the blog array, you would want to make sure to change the for a line to: for a in 1 2 3 4 5 6 7 8 9 10.
Bash scripting is a relatively simplistic language, but can be very powerful.
This script could be easily modified to include error checking, create a log file where you can look over which files were changed, and when they were last changed, and you could also make it so that when the script ran, it asked you for which version number to use in the switch command.
I have also used Bash scripting to upload the same plugins to a number of different blogs all at once, make edits to the .htaccess file, and delete certain files.
If you have access to your server and can run Bash scripts, I suggest you play around with them, as they can be a great tool when the right circumstances rear their ugly head.