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.
-
#!/bin/bash
-
CURDIR=$(pwd)
-
SITE="http://yoursite.com/blog"
-
echo Updating Wordpress in $CURDIR
-
echo 1. downloading latest build
-
wget -q http://wordpress.org/latest.tar.gz
-
echo 2. unpacking latest build
-
tar zxf latest.tar.gz
-
cd wordpress/
-
echo 3. replacing old files with fresh ones
-
tar cf - . | (cd $CURDIR; tar xf -)
-
echo 4. updating your blog
-
wget -q -O - ${SITE}/wp-admin/upgrade.php?step=1> /dev/null
-
echo 5. removing unneeded files and directory
-
rm -f ../latest.tar.gz
-
echo 6. all 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:
- Go to the wordpress root, where wp-config.php sits
- Using your favorite editor (pico ?) create a new file named updatewp
- Paste the code in the newly created file, save, exit
- chmod +x updatewp
- 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 :)
pingback on 28/Oct/07 at 6:58 am # :
[...] Microsoft 系统的批处ç†è„šæœ¬ï¼Œä½†ç›¸æ¯”ä¹‹ä¸‹åŠŸèƒ½è¦å¼ºå¤§å¾—多。感谢 Ozh æä¾›ä¸‹é¢çš„代ç : PLAIN TEXT [...]
replied, on 29/Oct/07 at 4:54 pm # :
I would add two lines after line 15 to delete the unpacked wordpress folder:
...
16. cd ..
17. rm -f -r wordpress
18. echo 6. all done !
pingback on 30/Oct/07 at 10:16 am # :
[...] nervige Updaten von WordPress kann man, wie ich heute bei Ozh gesehen habe, extrem vereinfachen! Alles was dafür benötigt wird, ist das folgende, [...]
pingback on 31/Oct/07 at 5:55 pm # :
[...] 今天在这里找到了一个好东西 - WordPress Bash å‡çº§è„šæœ¬ã€‚å¯¹äºŽæœ‰ SSH æƒé™çš„æœ‹å‹æ¥è¯´ï¼Œè¿™å¯èƒ½æ˜¯æœ€ç®€å•çš„å‡çº§ WordPress 的方å¼ï¼ˆSVN update 除外)。花儿已ç»åœ¨ BPCN å’ŒèŠ±å„¿å¼€äº†ç”¨è¿™ç§æ–¹æ³•æˆåŠŸå®Œæˆäº†å‡çº§ï¼Œæ‰€ä»¥è¯·å¤§å®¶æ”¾å¿ƒä½¿ç”¨ [...]
pingback on 06/Nov/07 at 1:41 pm # :
[...] åœ¨æ•´ç†æ’件的过程ä¸ï¼Œå‘现了一个很好用的wordpress自动å‡çº§è„šæœ¬ï¼Œéžå¸¸å¥½ç”¨ã€‚ä¸è¿‡è¦ä½¿ç”¨è¿™ä¸ªwordpressè„šæœ¬çš„å‰ææ˜¯ä½ éœ€è¦æœ‰æœåŠ¡å™¨çš„shellæƒé™ã€‚ #!/bin/bash [...]
pingback on 21/Nov/07 at 5:49 pm # :
[...] Peter Westwood’s description of the changes in WordPress 2.3.1. Also see PlanetOzh’s WordPress Upgrade Script for those with shell access to their web server, making upgrading WordPress “a matter of [...]
pingback on 29/Nov/07 at 8:29 am # :
[...] Peter Westwood’s description of the changes in WordPress 2.3.1. Also see PlanetOzh’s WordPress Upgrade Script for those with shell access to their web server, making upgrading WordPress “a matter of [...]
wrote, on 18/Jan/08 at 7:43 am # :
Will this preserve custom themes?
replied, on 18/Jan/08 at 8:57 am # :
Tyler Menezes » It has nothing to do with themes.