{"id":702,"date":"2007-10-27T21:56:58","date_gmt":"2007-10-27T19:56:58","guid":{"rendered":"http:\/\/planetozh.com\/blog\/2007\/10\/wordpress-upgrade-script\/"},"modified":"2007-10-27T21:56:58","modified_gmt":"2007-10-27T19:56:58","slug":"wordpress-upgrade-script","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2007\/10\/wordpress-upgrade-script\/","title":{"rendered":"WordPress Upgrade Script"},"content":{"rendered":"<p>If you have shell access to your webserver, upgrading to the latest WordPress build can be a matter of painless <em>seconds<\/em>. As usual there is more than one way to do it, and here is one of these ways &#8212; the script I am using.<\/p>\n<div class=\"igsh-code-box\" id=\"ig-sh-1\"><pre class=\"language-none line-numbers\" data-no-optimize=\"1\" data-cfasync=\"false\"><code class=\"language-none\">#!\/bin\/bash\r\nCURDIR=$(pwd)\r\nSITE=&quot;http:\/\/yoursite.com\/blog&quot;\r\necho Updating Wordpress in $CURDIR\r\necho 1.  downloading latest build\r\nwget -q http:\/\/wordpress.org\/latest.tar.gz\r\necho 2.  unpacking latest build\r\ntar zxf latest.tar.gz\r\ncd wordpress\/\r\necho 3.  replacing old files with fresh ones\r\ntar cf - . | (cd $CURDIR; tar xf -)\r\necho 4.  updating your blog\r\nwget -q -O - ${SITE}\/wp-admin\/upgrade.php?step=1 &gt; \/dev\/null\r\necho 5.  removing unneeded files and directory\r\nrm -f ..\/latest.tar.gz\r\necho 6.  all done !<\/code><\/pre><\/div>\n<p>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 <em>\/wp-admin\/upgrade.php<\/em> step, and removes temporary files. Literally takes seconds to upgrade.<\/p>\n<p><strong>Newbie how-to:<\/strong><\/p>\n<ol>\n<li>Go to the wordpress root, where <em>wp-config.php<\/em> sits<\/li>\n<li>Using your favorite editor (<em>pico<\/em> ?) create a new file named <em>updatewp<\/em><\/li>\n<li>Paste the code in the newly created file, save, exit<\/li>\n<li><em>chmod +x updatewp<\/em><\/li>\n<li>To upgrade WordPress: just type <em>.\/updatewp<\/em> in the root dir<\/li>\n<\/ol>\n<p><strong>Note:<\/strong> 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 :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8212; the script I am using. Modify line 3 to reflect your blog URL and here you go. The script downloads\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_ozhmd_markdown":"","footnotes":""},"categories":[21],"tags":[5,2,3,258,245],"class_list":["post-702","post","type-post","status-publish","format-standard","hentry","category-published","tag-bash","tag-code","tag-linux","tag-upgrade","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=702"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/702\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}