WordPress mass update script 3.3


This script will search /var/www (changeable in a variable) for any wordpress installs and make sure its upgraded to the latest version.
It will run a backup to /root/wp_upgrade/ of all files and database before doing anything with the site in case of major catastrophe (make sure you have spare disk space if your sites have a lot of uploaded files).

I have now added putting the site into maintenance mode whilst upgrading. This just involves adding a .maintenance in the document root.

It pays to check each site after the upgrade to make sure plugins all worked (and upgrade plugins before the upgrade works also!)

Let me know if you have any bugs at all, or any problems.

Here’s your script to upgrade them all.

wget http://b.ri.mu/files/wordpress-upgrade-3.3.sh
bash wordpress-upgrade-3.3.sh

MD5
a976aca14faf744f6271f8b8de9f59cb wordpress-upgrade-3.3.sh

SHA1
cdcda9912cd9e0063cd3d0930cd55b07ae2bda96 wordpress-upgrade-3.3.sh

If you find any bugs or problems, just let me know at liz at rimuhosting dot com


6 responses to “WordPress mass update script 3.3”

  1. Hi Liz,

    Does it have the ability to exclude a directory?
    I have a bunch of sites I want to do automagically, but a couple that have bespoke code that need to be sussed out before (and in some cases not actually) upgrading.

    • it asks for confirmation before upgrading any site.
      ie this is the output
      You have version 3.2 Standerd WordPress located at /var/www/cambridgenzed.co.nz/html/ that needs updateing to 3.3
      Would you like me to upgrade it? [y/N] y
      Upgrading /var/www/cambridgenzed.co.nz/html/
      Checking i can connect to the db, if so get and set sitename variable
      Database connects fine
      Site URL is http://cambridgenzed.co.nz
      Making backup at /root/wp_upgrade/cambridgenzed.co.nz.sql and /root/wp_upgrade/cambridgenzed.co.nz.zip (you can delete these later)
      Checking we have latest wordress …Unzipping …
      Setting up maintenance mode
      Copying files over …
      Changing permissions to vftp:vftp
      Doing the database upgrade with wget -q -O /dev/null http://cambridgenzed.co.nz/wp-admin/upgrade.php?step=1
      Going back to normal mode

      So each site needs to be manually approved, this means you can leave out a site :)