Neto Cury made a tutorial for Portal WordPress (portuguese only) about upgrading WordPress in a simple way using the .tar file and cPanel, and I decided to do something better (for geeks): upgrade WordPress from linux shell.
I’ll describe in just 3 steps the same I did on Wireless Blog Brasil and SeuJones.com (portuguese only). Before you continue reading, I advise this tutorial only works if you have shell access to your web server. If you just control your hosting through a web panel, like cPanel, please follow Neto Cury’s tutorial.
On my server, I work with the following directory structure:
/ - root of your site
/wordpress - path for WordPress instalation
/wp0 - temporary directory for the updated WordPress files
/wp1 - temporary directory to move the old WordPress
Use your own structure and the follow steps below:
1. Download most recent WordPress
Make your server download the latest stable release of WordPress and unpack it on /wp0 directory
$ mkdir wp0
$ cd wp0
$ wget http://wordpress.org/latest.tar.gz
$ tar -zxvf latest.tar.gz
After unpack all files on /wp0, we need to move the content from new extracted folder ‘wordpress’ to /wp0 directory.
$ mv -rf wordpress ../wp0
$ rm latest.tar.gz
2. Copying files from already running version
We need to copy now the config files from actual instalation, and if exists, the language files.
$ cd ..
$ cp wordpress/wp-config.php wp0/
$ mkdir wp0/wp-includes/languages
$ cp wordpress/wp-includes/languages/* wp0/wp-includes/languages/
Now we copy the theme and plugings files to the new release:
$ cp -rf wordpress/wp-content/themes/* wp0/wp-content/themes
$ cp -rf wordpress/wp-content/plugins/* wp0/wp-content/plugins
3. Finally upgrading
It’s necessary to do a simple renaming on the directories we are working on:
$ mv wordpress wp1
$ mv wp0 wordpress
And finally, we upgrade database accessing the wizard from WordPress:
http://yourblog/wordpress/wp-admin/upgrade.php
Open your blog and test navigation on most links. If everything is ok, you can safelly remove the wizard and the old WordPress instalation files:
$ rm wp1
$ rm wordpress/wp-admin/upgrade.php
Finished!
Advantages:
- You don’t need to download all zip/tar file, extract on your computer and upload it again to your server
- You don’t need to do a database backup (not recommended for most users)
- You don’t need to disable all plugins and reactivate it again after upgrade
Risks:
- If you don’t know what you’re doing, everything can be wrong! :)
Of course this solution is only for geeks that like shell commands like me. Someone can think it’s most secure to follow Neto Cury’s steps or oficial documentation way, but I tired to do all the work every time an update is released.
The fact is that has not being strictly necessary to make backups, stop all plugins, etc. But a remember, it’s always possible to something goes wrong and you need more than patience and knowledge to detect where error ocurred and fix it.
If you liked this text, please leave a comment! Blogger from Brazil will be thankful! :)

Nenhum comentário até agora
Deixe seu comentário