webponce rants

things less interesting than a pigeon walking in a circle.


svn.class.php

We've pretty much switched over to using SVN for all of our LAMP deployments now, as well as during development. Its quite often useful for our, say, flash development team to be able to check their recent committed changes on the development server, but they don't always have access via SSH, so i've started writing a really basic SVN class for PHP which allows the developer to run an SVN Update without SSHing in.

I'm sure there are PHP bindings somewhere to make this more effecient, but this should work on most machines where exec() is supported. The example below is for Windows machines, as you have to pass the full path to subversion in case your PATH is not setup correctly.


class svn {

var $svn_exe_path;

function svn() {
$this->svn_exe_path = '"\Program Files\Subversion\bin\svn.exe"';
}

function update() {
return `$this->svn_exe_path up`;
}

}


You will need to make sure you have a windows commandline installation of subversion (as i've used tortoise for most of my time with svn on windows, i never needed it until now). It is available here: Subversion for Windows including Command Line installation