Hehe, that's the file i'm most proud of
. Let me give you an introduction to it.
This class was coded by me, and it's basically a wrapper for SVN commands. Before you do anything, you should really read through the three articles i've written on SVN: Introduction
, Command line
. Once you understand these, you're definately ready to use it. It's important that you understand SVN.
Now, what are the requirements to use this class? You must have subversion binaries installed on your server. Without this, it will not work. If you are running on shared hosting, you will probably not have this, so you either need to have very friends who run your hosting or a dedicated box, that let's you install anything. So first of all, ask your host if they have SVN, and in case they don't, if they can install it. Also, PHP's exec() function needs to be available, and it needs to have permission to call SVN.
Now, another requirement is an SVN repository. You need an SVN repo to get the files from. As already mentioned, STG also uses SVN for their website. We do so too, in fact you can find some more information and statistics over here
. You can have this set up at various places, we use assembla.com, because it allows private repositories.
Now, another thing i'll have to mention - and this is the case for most of the files in the phpbbmodders library - is that the files use PHP5 coding techniques. This means that you'll have to have at least PHP 5.0, but 5.1 or 5.2 would probably be even better.
If you meet all those requirements, you can get the file onto your server and do something like this (this is inside a phpBB page):
- Code: Select all
include($phpbb_root_path . 'includes/lib/functions_svn.' . $phpEx);
* build it all, paths should end with /
* @param string $local_copy_path path to the local svn copy
* @param string $local_bin_path path to the svn binaries dir
* @param string $local_config_path path to the svn configuration
* @param string $svn_repository path to the svn repo
* @param string $svn_username username for svn server
* @param string $svn_password password for svn server
* @param string $svn_bin binary file for SVN
$svn = new svn_commands('/home/path/to/public_html/', false, false, 'http://svn.example.com/my_site_repo/', 'my_svn_username', 'my_svn_password');
Just an example for a script that updates the website to the latest SVN revision. Here at phpBBModders.net, we have an ACP module to do that
. As you can see, i've used absolute paths in the constructor. This is not required, but HIGHLY
suggested, as it's bound to lead to problems if chdir() is called.
I hope this could help you guys a little
Something i forgot to mention, the SVN class does currently not work with https, that's something i've not managed to get working yet. The problem is that the subversion binary asks you to confirm if you want to trust that site, and i'm not sure how i'm supposed to input into the program. If anybody has an idea i'd be very glad to hear from you!