Keeping WordPress up to date using the standard method of deleting old files, extracting the new ones and then running the database upgrade script is a bit cumbersome, but really not that difficult. Gallery2 uses more or less the same methodology, but it does not require you to delete your files prior to the upgrade because it generates a script to remove deprecated files after the install is complete. This is very kind of them, but the Gallery package is large, and upgrades can get a bit unwieldy. While there are certainly more difficult software packages to maintain, there are things I would much rather be doing than software updates, so I decided to make my life easier by using subversion to manage both applications.
Subversion is a code revision management tool that is everything CVS should have been. It is not only amazingly useful for software developers, but it can be readily used by end users as a convenient method of keeping their software up to date. It is for this reason that the Automattic and and Gallery folks have started recommending it for those who have command line access to subversion enabled servers.
There is no way to force the software to make an existing install into a subversion checkout, so to convert my site, I pretty much just followed the instructions at wordpress.org site.
Create a directory for the new install and “cd” into it:
$ mkdir wordpress-svn
Checkout the current WordPress version:
$ svn co http://svn.automattic.com/wordpress/tags/2.3.1 .
Copy the things I cared about into from the old directory into the new one:
$ cp ../wordpress/wp-config.php .
And the same for:
The only thing I didn’t really like was their method for copying the files from the old wp-content directory to the new one.
They suggested using “cp -rpf”:
$ cd wordpress
$ cp -rpf wp-content/* ../wordpress-svn/wp-content
But I prefer to use a “tar | tar” operation as root from my original wp-content directory.
$ cd wordpress/wp-content
$ tar cpEf - * | (cd ../../wordpress-svn/wp-content; tar xf -)
I don’t really have a reason for this other than it’s the way I have always moved large directories full of files with varying permissions. I just have more confidence in “tar” to maintain permissions than I do “cp”. I seem to remember being bitten by “cp” while moving some Oracle databases at some point.
That pretty much did it for WordPress… Next I moved onto Gallery2. The process was very similar.
Create the new gallery2 directory within your wordpress-svn folder and “cd” into it:
$ mkdir gallery2
Checkout the latest version of the Gallery2 code:
svn co https://gallery.svn.sourceforge.net/
Copy over the config file:
cp ../../wordpress/gallery2/config.php .
Finally, copy the g2data directory over using “tar | tar”:
$ cd ../../wordpress/gallery2/g2data
$ tar cpEf - * | (cd ../../wordpress-svn/gallery2/g2data; tar xf -)
That was it… Now all that was left was to rename wordpress to wordpress-presvn and wordpress-svn to wordpress:
$ mv wordpress wordpress-presvn; mv wordpress-svn wordpress
Everything worked fine, so I was golden. If it had not been, I could have simply renamed the directories back to their original names.
What did all this get me? Much much easier upgrades. Upgrading WordPress is now just a matter of switching to the latest tag and running “svn up”:
$ svn sw http://svn.automattic.com/wordpress/tags/2.3.2
$ svn up
With Gallery, however, there is no need to do a switch for dot releases, so until it goes from 2.2.x to 2.3.x there is no need to run the “svn switch”… I can just “svn up”.
Remember that this is a 10,000 foot view of the process. Please read the links to the Automattic and Gallery documentation if you are going to make the move yourself.