kdmurray.blog

Thoughts and opinions of a technology enthusiast.

WordPress Upgrade Script

For those of you who run your own blogs, and take care of the updates yourselves, I’ve created a WordPress Upgrade script. Note: This is a Linux/Unix/Mac OS X shell script, not a Windows batch file.

The script is very simple:

  1. Download the latest WordPress archive from the website
  2. Uncompress it to a temporary location
  3. Migrate all of the themes, plugins and uploads
  4. Copy over wp-config.php
  5. Back up the old version
  6. Move the new version into the proper folder

Inspiration for this came with this week’s WordPress 2.1.1 update. I figured if I have to keep up with all the security updates, I might as well just build a script to simplify matters.

Download a copy of the script from here.

Questions, comments, compliments or constructive criticism will be gladly accepted!

Category: Uncategorized
  • Pingback: Multi-faceted Abnormal /blog » Typical

  • http://multifaceted-abnormal.net Evamaria

    Found this via your comment to the upgrade instructions via shell access and will probably use it in the future for my various manually updated WP installations. Just one (probably stupid) question: Do I copy your script completely into the Terminal, or do I go line by line? I’ve never used a shell script before, only very basic shell commands (cd, wget, rm, rar, etc.), so I want to make sure I do it right… Thanks in advance!

  • Simon B

    i maintain about 15 WP sites for customers, so something like this could save me hours!

    however, i’m a complete newbie at scripting, so could you tell me how i run the script? i’m running windows on my pc, so i use winscp to connect to my server, then from within winscp i open a putty window. how do i run your script from putty?

    i’ve noticed also that the value for prodfolder is hardcoded into the script – is it possible to pass this in as a parameter?

    sorry for all the questions…!

  • http://krell.cellsandbytes.net/ Keith

    ##Evamaria & ##SimonB, I think that these instructions should help both of you:

    1. Connect to your server via SSH
    2. Download the script: wget http://krell.cellsandbytes.net/wp-content/uploads/wp-upgrade
    3. Place the file in the parent to your wordpress installation(s)
    (ie. if wordpress is in /myuser/www/myWPsite then the script should be at /myuser/www/wp-upgrade

    The script was designed originally to upgrade a single instance of WordPress, if you have several to upgrade you will need to run the script multiple times.

    ##SimonB — The PROD_FOLDER variable is set to a default in the script, but you can pass a parameter to the script specifying which folder contains your WP installation: wp-upgrade myWPsite

  • Walter

    You should copy .htaccess as well.

  • Pingback: Extralogical · WP, Shell and Me

  • Pingback: Vorsicht! Tollwütiges Upgradescript! » bastelblog

  • http://www.bos89.nl Martijn Stegink

    It doesn’t quite work on Osx. Wget was replaced with curl there and some other stuff didn’t work either. Didn’t figure it out yet.

  • http://krell.cellsandbytes.net/ Keith

    The WGET problem can be resolved with this: http://krell.cellsandbytes.net/wp-admin/post.php?action=edit&post=131
    If you have any ideas what the other problems might be, let me know and I’ll see if I can make a more generally useful version of the script. :)

  • http://epe.at/blog/ eric

    Hi,

    isn’t it necessary to disable all the plugins before upgrading?
    otherwise, nice script, which I’ll probably use on my wordpresses :)

  • http://krell.cellsandbytes.net/ Keith

    Not sure how I missed your comment from last month, Eric. To my knowledge the plugins don’t _need_ to be disabled, but I’ll do some additional reading on the topic and see if I can come up with an answer in the next version of the script. :)

  • Pingback: Top methods for keeping your Wordpress installation and Wordpress plugins up-to-date | fiLi’s tech

  • http://GarySaid.com/ Gary LaPointe

    The script doesn’t seem to be there any more…

  • http://kdmurray.net/ kdmurray

    @Gary: The link has been corrected. Thanks.