====== Upgrading WordPress websites ======
This is slightly different from the standard instructions although most of the standard instructions will apply. It is different because
* The way I have installed WordPress is to enable it from a single install path for all websites
* And also to use a single MySQL database for all installs with just table prefix being different
Please refer to [[tech:linux:creating_wordpress_websites_on_ub1|Creating WordPress Websites]] for adding new WordPress websites
To do the manual upgrade usually requires you simply overwrite the new WP files. Check the latest version upgrade instructions to be sure. Once that is done you can log on to each site and click upgrade to upgrade the database. Below is a SQL script to help you check the version of all your wordpress sites
==== Checking the version of all the wordpress sites ====
Use this SQL to check in one go. Include more lines as required of course!
select 'wp01_options' table_name, option_value from wp01_options where option_name = 'db_version'
union all
select 'wp02_options' table_name, option_value from wp02_options where option_name = 'db_version'
union all
select 'wp03_options' table_name, option_value from wp03_options where option_name = 'db_version'
union all
select 'wp04_options' table_name, option_value from wp04_options where option_name = 'db_version'
union all
select 'wp05_options' table_name, option_value from wp05_options where option_name = 'db_version'
union all
select 'wp06_options' table_name, option_value from wp06_options where option_name = 'db_version'
union all
select 'wp07_options' table_name, option_value from wp07_options where option_name = 'db_version'
union all
select 'wp10_options' table_name, option_value from wp10_options where option_name = 'db_version'
union all
select 'wp11_options' table_name, option_value from wp11_options where option_name = 'db_version';
...
===== Steps =====
Below are steps to completing the upgrade
==== Download latest WordPress ====
* Go to the path of your WordPress current install. Let's assume this is /www/path/to/wordpress
* Note you will need to be ONE DIRECTORY ABOVE this path
* Do cd /www/path/to/wordpress/..
* Remove any old downloads rm latest*.zip
* The latest release of WordPress is usually at "http://wordpress.org/latest.zip", so do a wget "http://wordpress.org/latest.zip"
==== Follow instructions to upgrade ====
* The latest (at this writing 3.0.4) required delete of the old wp-includes and wp-admin directories, so let's do that as follows. There is a catch to this step as my WordPress script is under svn. Also the instructions below don't delete the directories themselves. If they happen to be extra there is very minimal chance that this will affect WordPress working in anyway. For that matter even left over files should not be a problem and you can probably skip these steps entirely. Refer [[http://codex.wordpress.org/Upgrading_WordPress|Upgrading WordPress]]
* Runcd wordpress/wp-includes
* Runfind .|grep -v "\.svn"|xargs rm
* Runcd ../wp-admin
* Runfind .|grep -v "\.svn"|xargs rm
* Back to root folder (/www/path/to) cd ../..
* Run the unzip to overwrite the files. Accept when prompted for overwrite unzip latest.zip
==== View and commit all changes ====
* Go to the wordpress directory which now has all the new files cd wordpress
* Run svn status
* Do a svn delete for those files with an "!" and then run svn commit, below are the steps
* For svn deleting files that have been O/S deleted Run svn status|grep "^\!"|awk '{print $2}'|xargs svn del
* For adding new files do svn status|grep "^?"|awk '{print $2}'|xargs svn add
* Do Commit svn commit -m "Upgraded WordPress"
* Make sure you set permissions back on WordPress Directory depending if you did this as root or a non-apache user
* Back to root folder (/www/path/to)
* cd ..
* chown -R www-data:www-data wordpress
==== Upgrade the Blog database ====
* Go to the admin URL of the wordpress site and complete the upgrade which will upgrade the database for the blog
* Repeat above step for each blog