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 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 Upgrading WordPress
    • Run
      cd wordpress/wp-includes
    • Run
      find .|grep -v "\.svn"|xargs rm
    • Run
      cd ../wp-admin
    • Run
      find .|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

QR Code
QR Code tech:linux:upgrading_wordpress_sites (generated for current page)