Using WordPress in an SVN environment
So you have an SVN repo and you’re trying to push out wordpress to a web server.
Congrats to you for not allowing cowboy users to go in and muck around with code w/o the ability to fully restore a website, but you’ve also just shot yourself in the foot because wordpress allows you to do all sorts of crazy cool stuff like uploading themes, plugins, images, etc.
I had the same problem to deal with.
The best bet I think is just to have a cron that runs on the working copy hosted on the web server that takes the files that have been added to the installation directory and shoots them back up to the master copy. If you’re good with SVN, you know that you can’t just run an SVN add command because it simply won’t work.
Here’s something you can cron that recursively adds files in a wordpress install coming from SVN. Of course this implies you’ve figured out a way to get svn check in and out to work without interactivity.
#!/bin/bash
DOCROOT=/var/www
cd $DOCROOT
svn status | grep "^\?" | awk '{print $2}' | xargs svn add
svn commit -m "added to repo from cron"
Go ahead, ssh into your web server and try it yourself. Works like a charm.
Careful though, if the site has a bunch of user generated uploaded media, that’s going to get checked in too, and that means longer checkout times from SVN.
tf
