In: , , , ,
On: 2007 / 10 / 27 Viewed: 56883 times
Shorter URL for this post: http://ozh.in/g6

If you have shell access to your webserver, upgrading to the latest WordPress build can be a matter of painless seconds. As usual there is more than one way to do it, and here is one of these ways -- the script I am using.

CODE:
  1. #!/bin/bash
  2. CURDIR=$(pwd)
  3. SITE="http://yoursite.com/blog"
  4. echo Updating Wordpress in $CURDIR
  5. echo 1downloading latest build
  6. wget -q http://wordpress.org/latest.tar.gz
  7. echo 2unpacking latest build
  8. tar zxf latest.tar.gz
  9. cd wordpress/
  10. echo 3replacing old files with fresh ones
  11. tar cf - . | (cd $CURDIR; tar xf -)
  12. echo 4updating your blog
  13. wget -q -O - ${SITE}/wp-admin/upgrade.php?step=1> /dev/null
  14. echo 5removing unneeded files and directory
  15. rm -f ../latest.tar.gz
  16. echo 6all done !

Modify line 3 to reflect your blog URL and here you go. The script downloads the latest build, unpacks it, overwrite your files and keeps file attributes, update your blog with the often forgotten /wp-admin/upgrade.php step, and removes temporary files. Literally takes seconds to upgrade.

Newbie how-to:

  1. Go to the wordpress root, where wp-config.php sits
  2. Using your favorite editor (pico ?) create a new file named updatewp
  3. Paste the code in the newly created file, save, exit
  4. chmod +x updatewp
  5. To upgrade WordPress: just type ./updatewp in the root dir

Note: this is based on a script I found a couple of years ago, which introduced me to the wicked tar piped line (step 3). I completely forgot where I found this originally, so if you have the feeling you might be the original coder, feel free to raise your hand in the comments :)

Related posts

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/g6

Metastuff

This entry "WordPress Upgrade Script" was posted on 27/10/2007 at 9:56 pm and is tagged with , , , ,
Watch this discussion : Comments RSS 2.0.

13 Blablas

    Pages: [2] 1 » Show All

  1. 13
    Hackers Highlight 8 March 2009 | WPLover United States »
    pingback on 08/Mar/09 at 2:41 am # :

    [...] multiple WordPress installations. Stephen Rider offered up Virtual Multiblog. Ozh linked to his WordPress Upgrade Script. Eric Marden listed some of the more general build process tools: Phing, Capistrano, Ant, Maven, [...]

  2. 12
    WordPress Wednesday: Upgrade Script | To... United States »
    pingback on 04/Mar/09 at 6:12 am # :

    [...] WordPress Upgrade Script « planetOzh. [...]

  3. 11
    Upgrading Wordpress Script | Nate's Brai... United States »
    pingback on 07/Dec/08 at 10:19 pm # :

    [...] http://planetozh.com/blog/2007/10/wordpress-upgrade-script/ [...]

Pages: [2] 1 » Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?

Close
E-mail It