WordPress Upgrade shell Script – plugins, themes, crontab and more!

It's been some time since i upgraded my wordpress upgrade script. Several reasons why, partially because i had patches from other people to merge in, partially laziness on my part (being busy with other things).

However, the good news is, it is here, and its amazing and awesome and you should never need to update the script again. Now we are using all APIs to get the latest wordpress version, as well as upgrading the plugins and themes.

Not only that, but it can now run from cron and just notify you of updates (without running the updates), as well as checking for dependencies

all-the-things

So this is how you get it, and how it works.

wget http://b.ri.mu/files/wordpress-upgrade.sh
chmod +x wordpress-upgrade.sh

By default, when you run it, it checks /home and /var/www for old wordpress installs, and offers to upgrade those. If your blogs are located in either just run it as is

./wordpress-upgrade.sh

If you have a different place you can do it like this

./wordpress-upgrade.sh --path /opt/some/path

Another feature i added, was the ability to run it on a crontab. This just detects where the wordpress installs are out of date, and you can output that to email (using MAILTO variable) or pretty much anything you want.

./wordpress-upgrade.sh -c

If you have a different path, you can run it like this

./wordpress-upgrade.sh -c /opt/some/path

This has been tested and should work on both deb/apt based, and rpm based systems. If you have any bugs, patches or other information that can help us make this work better, by all means email me liz at rimuhosting dot com

Special thanks to DropDeadDick ( http://dropdeaddick.com ) , Anthony Bouch ( www.abouch.com ), Simon Oosthoek, and Bokusatsu Tenshi for contributions in various forms.

This entry was posted in Featured, HOWTO and tagged , , , , , . Bookmark the permalink.

5 Responses to WordPress Upgrade shell Script – plugins, themes, crontab and more!

  1. ondiz says:

    Tnx man I'm lovin this metod...

  2. Svyatoslav says:

    @ondiz - Actually, its "Tnx woman", since author is Liz ;)

    And yes, thank you Liz! Would like to note though is that this approach WILL backfire. Let's compare the situation : WP VS Drupal. Drupal is generally more stable and better (in terms of quality) developed, yet its hard to use it because you have to hack many things and automatic update is not really supported. WP, on the other hand, is most updated and most automatized solution there is (talking OS here), yet security, and more importantly, upgrade safety is not guaranteed.

    In other words, suppose we use your really nice script, upgrading via cron. Then, one day, as it usually is, WP team decides to change their API, and some of your plugins fail to work. Now its half problem if they just fail to work, but what if they take down the whole site with WSoD? And you will not know about it, until you actually access it or somebody notifies you.

    In my personal practice, about a month ago, I had exactly the situation (except I was doing it manually). Upgraded WP Core - qTranslate, - plugin that keeps non-English users on the site, - failed to work. Actually, it did not failed as in completely, rather rendered unusable by inability to switch translations in post editor. Solution was either find the reason why or fix it; or disable this feature (its like disabling 3/4 of site); or downgrading, which unless you have backup can be really painful.

    So, the question is - do we really need to upgrade WP automatically?

    • Liz Quilty says:

      I would suggest never leaving it totally automated if you can help it, which is why this one prompts before each one (its caught several backups which i didnt want to upgrade before). I test each site after upgrading, this just enables me to upgrade clients wordpress without needing to know the admin login and password

  3. adi says:

    Hi Liz, great script. But I have problem because the script set the chmod to 750 for addon domain main folder. It make my website that using addon domain can't opened from browser

    • Liz Quilty says:

      It does not chmod anything at all, however it does do a chown to make sure the original owners. It checks the folder wp-content for ownership on this line
      orig_perm=$(stat -c '%U:%G' $wp_root/wp-content/)

      If you want to edit that to comment it out look for the part that says this

      echo Changing permissions to $orig_perm
      /bin/chown -R $orig_perm $wp_root

      Feel free to edit it if you have a particular setup or file you want it to check for permissions.

Leave a Reply

Your email address will not be published. Required fields are marked *


3 − one =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>