Upgrading WordPress in Bulk

Of course there is the old faithful Updating_WordPress_with_Subversion and Upgrading_WordPress_Extended, but there is a lot of fluff there. Old blogs are “You are using WordPress 2.9.1”. Show me the command lines.

Certainly.

  • “Backup your database. Read Backing Up Your Database for a detailed explanation.”
    • Use Plugin WP-DB-Backup from http://austinmatzko.com/wordpress-plugins/wp-db-backup/
    • Download it – make sure the copy is here. Open it up.
  • “Backup ALL your WordPress files in your WordPress directory. Don’t forget your .htaccess file.”
    • Make a local shadow directory
      • $ rsync -vur ./sarajane/ ./backups/sarajane-snapshot-20110416/
    • Make a tar file for download for archive
    • $ tar cvf sarajane-snapshot-20110416.tar sarajane/
    • $ gzip sarajane-snapshot-20110416.tar
    • Verify the backups you created are there and usable. This is essential.
  • “Deactivate ALL your Plugins.”
  • “Ensure first four steps are completed. Do not attempt the upgrade unless you have completed the first four steps.”
  • Gotta upgrade the MYSQL Database? I did… The nice thing is, use two different ones. Since you saved the original directory, you can switch back to old state and db by replacing the directory.
    • Per Backing_Up_the_Database
      • $ mysqldump --add-drop-table -h mysqlservername  -u mysqlusername -p dbname> ms-db-backup-20110416.sql
  • edit wp-config.php (save the old one)
  • $ cp wp-config.php wp-config.php.save
  • $ vi wp-config.php ...
  • Use new SVN install into new folder
    • $ mkdir sarajane2
    • $ cd sarajane2
    • $ svn co http://core.svn.wordpress.org/tags/3.1.1 .
  • Copy these files from your old site to the new
    • $ export OLDBLOG=$HOME/sarajane
    • $ export NEWBLOG=$HOME/sarajane2
    • $ cp $OLDBLOG/wp-config.php $NEWBLOG/
    • $ ls $OLDBLOG/wp-content/cache
    • $ rm -rf $OLDBLOG/wp-content/cache
    • $ ls $OLDBLOG/wp-content/plugins/widgets
    • $ rm -rf $OLDBLOG/wp-content/plugins/widgets
    • $ rsync -vur --exclude=.svn/ $OLDBLOG/wp-content/ $NEWBLOG/wp-content
  • # this only is in older WP installs
    • $ rsync -vur --exclude=.svn/ $OLDBLOG/wp-images/ $NEWBLOG/wp-images
    • $ cp sarajane/.htaccess sarajane2
  • Swap directories
    • $ mv sarajane sarajane0
    • $ mv sarajane2 sarajane
  • Hit the upgrade link

Atualhalpa stores settings in the database, so you don’t have to copy anything.

This entry was posted in Computers, howto, Software and tagged , , , , . Bookmark the permalink.

Leave a Reply