K’s Weblog

Technology and the Interweb for the Real World

Foot bridge in a Kyoto garden

Wordpress Upgrade Script

February 22nd, 2007 · 14 Comments

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!

Tags: Admin Tools · Blogging · Downloads · Utilities

Related Posts

  • Wordpress 2.3 Released — Changes Iminent
  • WordPress 2.6 - Restore the “Add Image” button
  • Security vs. Functionality
  • Last Post from Tiger…
  • Wordpress 2.5: The rubber hits the road



  • 14 responses so far ↓

    • 1 Multi-faceted Abnormal /blog » Typical // Mar 3, 2007 at 1:49 pm

      [...] on a Mac, I have also found a link to an upgrade shell script. Might try this for some of my other WP installations, as they all predate my move to DreamHost [...]

    • 2 Evamaria // Mar 3, 2007 at 1:55 pm

      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!

    • 3 Simon B // Mar 4, 2007 at 8:46 am

      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…!

    • 4 Keith // Mar 4, 2007 at 1:10 pm

      ##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

    • 5 Walter // Mar 4, 2007 at 4:09 pm

      You should copy .htaccess as well.

    • 6 Extralogical · WP, Shell and Me // Mar 9, 2007 at 9:52 am

      [...] WordPress Upgrade Script [...]

    • 7 Vorsicht! Tollwütiges Upgradescript! » bastelblog // Apr 4, 2007 at 6:45 am

      [...] Vor einiger Zeit habe ich über ein Updatescript gebloggt das Euer WordPress auf die aktuellste SVN Revision bringt. Als alter Bastler, Frickler und Fummler war mir das natürlich nicht genug und ich hab mich auf die Suche nach einem script gemacht, das auf die aktuelle Release-Version updated - und auch eines gefunden. [...]

    • 8 Martijn Stegink // Apr 9, 2007 at 1:22 pm

      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.

    • 9 Keith // Apr 13, 2007 at 5:14 pm

      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. :)

    • 10 eric // Apr 16, 2007 at 5:19 am

      Hi,

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

    • 11 Keith // May 20, 2007 at 10:05 pm

      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. :)

    • 12 Top methods for keeping your Wordpress installation and Wordpress plugins up-to-date | fiLi’s tech // May 21, 2007 at 4:39 am

      [...] can use most of of the upgrade scripts with PHP-shell. K’s blog has a shell script that will do upgrade your installation [...]

    • 13 Gary LaPointe // Dec 30, 2007 at 7:43 pm

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

    • 14 kdmurray // Jan 3, 2008 at 10:01 pm

      @Gary: The link has been corrected. Thanks.

    Leave a Comment

    Cutline by Chris Pearson