{"id":418,"date":"2011-03-29T21:49:18","date_gmt":"2011-03-30T03:49:18","guid":{"rendered":"http:\/\/hackarandas.com\/blog\/?p=418"},"modified":"2011-03-29T21:49:23","modified_gmt":"2011-03-30T03:49:23","slug":"updating-your-wordpress-blog-in-a-blink","status":"publish","type":"post","link":"https:\/\/hackarandas.com\/blog\/2011\/03\/29\/updating-your-wordpress-blog-in-a-blink\/","title":{"rendered":"Updating your WordPress Blog in a blink!"},"content":{"rendered":"<p><a href=\"http:\/\/hackarandas.com\/blog\/2011\/03\/29\/updating-your-wordpress-blog-in-a-blink\/wordpress-150\/\" rel=\"attachment wp-att-422\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hackarandas.com\/blog\/wp-content\/uploads\/2011\/03\/wordpress-150.gif\" alt=\"Wordpress Logo\" title=\"Wordpress Logo\" width=\"75\" height=\"70\" class=\"alignleft size-full wp-image-422\"  style=\"margin: 10px 10px 0pt 0pt; float: left;\" \/><\/a>  I know, I know&#8230; WordPress already has an option to update your blog with one click&#8230; but I love to use my SSH and I don&#8217;t trust FTP connections, so here is my manual solution for this. I hope you find it useful.<\/p>\n<pre lang=\"c\">\r\nssh myblog.com\r\n.\/updateblog.sh\r\nexit <\/pre>\n<p>That&#8217;s it, pretty fancy uh? This is the code for this script:<\/p>\n<pre lang=\"bash\">\r\n#!\/bin\/bash\r\n# Script by Adrian Puente Z..\r\n# Powered by Hackarandas www.hackarandas.com\r\n# Licensed by GNU GPLv3\r\n# http:\/\/www.gnu.org\/licenses\/gpl-3.0.txt\r\n\r\n# This is the absolute PATH to a working directory.\r\nUPGRADEPATH=\"\/home\/user\/mytempdir\/\"\r\n# Where the Blog is installed.\r\nBLOGPATH=\"\/home\/user\/complete\/path\"\r\n# The complete URL to the blog.\r\nBLOGURL=\"www.myblog.com\/complete\/path\"\r\n# For spanish version use this line.\r\nNEWWP=`curl -q http:\/\/es.wordpress.org\/ 2>\/dev\/null| grep download-tar | cut -d'\"' -f4`\r\n# For english version use this line\r\n#NEWWP=\"http:\/\/wordpress.org\/latest.tar.gz\"\r\n\r\necho -n \"Downloading ${NEWWP}, is this ok? [y\/N] \"\r\nread -n 1 OK\r\necho\r\nif [ ${OK} == \"n\" ]\r\nthen\r\n\techo Exiting...  \r\n\texit 0\r\nfi\r\n\r\ncd ${UPGRADEPATH}\r\necho Downloading new WP...\r\nwget ${NEWWP} -O- | tar zxf -  \r\nif [ $? -ne 0 ]\r\nthen\r\n\techo \"Problem found downloading latest release.\"\r\n\techo \"Exiting...\"\r\n\texit 1\r\nfi\r\n\r\necho Deleting old wp-admin and wp-includes..\r\necho -n \"is this ok [y\/N] \"\r\nread -n 1 OK\r\necho\r\nif [ ${OK} == \"n\" ]\r\nthen\r\n        echo Exiting...  \r\n        exit 0\r\nfi\r\n\r\nrm -fr ${BLOGPATH}\/wp-admin\r\nrm -fr ${BLOGPATH}\/wp-includes\r\n\r\necho -n \"Copying new files...i \"\r\ncp -r wordpress\/* ${BLOGPATH}\r\nrm -fr wordpress\/\r\necho Done\r\necho Now go to this URL to update database..\r\necho -e \"${BLOGURL}\/wp-admin\/upgrade.php\"\r\necho Bye.\r\nexit 0<\/pre>\n<p>You just need to change the variables according to your blog needs, each one is commented to best understanding and don&#8217;t forget to give execution access. This script has only been tested on Linux and you should only keep it inside your home not in the www or http folder to avoid that someone read it.  <\/p>\n<p>You can download it <a href=\"http:\/\/hackarandas.com\/hacking-projects\/updateblog.sh.gz\">here<\/a> under your own risk and don&#8217;t forget to check my other projects <a href=\"http:\/\/hackarandas.com\/hacking-projects\/\">here<\/a>.<\/p>\n<p>Any comment or doubt leave me a comment and I will try to reply it asap.<\/p>\n<p><strong>Adrian Puente Z.<\/strong><\/p>\n<p><a href=\"http:\/\/www.technorati.com\/tag\/Adrian+Puente+Z.\" rel=\"tag\">Adrian Puente Z.<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/Hackarandas\" rel=\"tag\">Hackarandas<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/ssh\" rel=\"tag\">ssh<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/blog\" rel=\"tag\">blog<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/update\" rel=\"tag\">update<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/wordpress\" rel=\"tag\">wordpress<\/a> <\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>I know, I know&#8230; WordPress already has an option to update your blog with one click&#8230; but I love to use my SSH and I don&#8217;t trust FTP connections, so here is my manual solution for this. I hope you &hellip; <a href=\"https:\/\/hackarandas.com\/blog\/2011\/03\/29\/updating-your-wordpress-blog-in-a-blink\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,4],"tags":[23,68,38,67,14],"class_list":["post-418","post","type-post","status-publish","format-standard","hentry","category-code","category-security","tag-hackarandas","tag-patch","tag-ssh","tag-update","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/posts\/418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/comments?post=418"}],"version-history":[{"count":22,"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions"}],"predecessor-version":[{"id":442,"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions\/442"}],"wp:attachment":[{"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/media?parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/categories?post=418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hackarandas.com\/blog\/wp-json\/wp\/v2\/tags?post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}