WordPress 1.2.2 was released in mid-December and includes a couple of important PHP-related security fixes, so everyone should upgrade, especially with the santy worm going around.
I upgraded tonight, and it was a pretty easy process:
Download and Prep New Version
- While connected to the root dir of the website via ssh, download the newest version
$ wget http://wordpress.org/latest.tar.gz
- Make a temp dir in the wombatnation.com directory
$ mkdir t
- Move tarball there
$ mv latest.tar.gz t
- Unzip it
$ tar xzf t/latest.tar.gz
- Move it back to root dir with different name than original install
$ mv t/wordpress wpnew
Now, I have a pristine version of WordPress 1.2.2 in the wpnew
directory.
Backups
- Use standard instructions to backup database
- Backup files. In root directory of website
$ tar czf wordpress_backup_20050101.tgz wordpress
- FTP the backup file to an off-site location
- Make a copy of the wordpress directory, preserving file attributes
$ cp -Rp wordpress wp2
Now, I have an exact copy of my current install. While I could always restore it from the backup file, diskspace is cheap and I like to have an easy-to-access copy while doing upgrades and migrations. Once the new version seems to be up and running, it’s easy enough to remove this directory.
Copy Customized Files
- Copy .htaccess, wp-config.php, wp-layout.css from wordpress dir to wpnew
- Copy comments related files
$ cp wordpress/wp-comment* wpnew
- The file wp-comments-post.php was changed for the WP 1.2.2 release. Since I had previously renamed this file in order to ward off spam comments, I had to redo that again. I’ve posted the details elsewhere.
I verified that the admin interface worked via accessing the files in the wpnew directory, and then switched in the new directory for the old one. This approach allowed me to keep my blog available for virtually the entire switchover.
$ mv wordpress wpold
$ mv wpnew wordpress
Obviously, the wpold and wp2 directories can now be deleted.