Aug 22

Wordpress auto updates

Posted on Saturday, August 22, 2009 in HowTo

Background

If you host, or have friends who host wordpress sites, then you know that upades are frequent, and its time consuming to upgrade each site.  I wanted to find a way to automate the process using a command line script, but before I thought about writing one, I thought someone else must have done this before.  Turns out they did.

Aaron Toponce wrote a wonderful script to do the upgrade, and as many of the comments on the site point out it has some serious flaws, but for anyone with some understanding of scripts, its a great start, thanks!

The main issues I found with it,  was the security issue, specificly that the backups are all stored in the public folder, and that was easy to remedy, however someone already did that too.

Jerry Bell updated the script and he also made some other enhancements, but not the one that I felt was most important.  The issue is, that it does not disable, and re-enable plug-ins.  Now, as far as I was able to determine, its not the most important thing to disable them, but it seems to me if wordpress claims it must be done, it should be done.

A little more research, and I was able to determine that the reason the scripts do not disable the plug-ins, is because you have to do it in the database.  Jeff Star pointed out how to disable & enable the plug-ins using the database.

Putting it all together

Using these resources I built a script that will:

  1. Download the latest version of wordpress
  2. Backup all the databases
  3. Backup the files and folders
  4. Disable the plug-ins
  5. Upgrade the wordpres directories
  6. Restore the files and folders
  7. Enable the plug-ins
  8. Clean up

Here is the final script.

Leave a Reply


SEO Powered by Platinum SEO from Techblissonline