functions_svn.php

Support for the phpbbmodders_lib.
mtotheikle
New member
New member
Posts: 25
Joined: 11 Oct 2007, 03:03
Real name: Mike
Location: Spokane, WA

functions_svn.php

Postby mtotheikle » 02 Jun 2008, 00:53

First off I would like to say great new site guys really has a lot of nice tools for modders. Any ways can this script be used to update a sites files and make them match the SVN?
Last edited by mtotheikle on 12 Jan 2015, 23:58, edited 2 times in total.
Reason: removed [question] from title

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David

Re: [Question] functions_svn.php

Postby harmlessgoat22 » 02 Jun 2008, 01:11

I've been wanting something like this as well. It would be great. I know startrekguide.com has this, and with SVN access, which I have, I could take it, but I don't want to figure everything out for it.
Image
That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

mtotheikle
New member
New member
Posts: 25
Joined: 11 Oct 2007, 03:03
Real name: Mike
Location: Spokane, WA

Re: [Question] functions_svn.php

Postby mtotheikle » 02 Jun 2008, 01:57

Ya I know STG has this as well after talking to HOL a couple days ago and think it is a great idea, I just don't know much about SVN to accomplish the goal and get it all to work right. Hopefully someone here does though!

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: functions_svn.php

Postby igorw » 02 Jun 2008, 08:47

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: [url=http://phpbbmodders.net/articles/general/svn_intro/]Introduction[/url], [url=http://phpbbmodders.net/articles/general/svn_advanced/]Advanced[/url], [url=http://phpbbmodders.net/articles/general/svn_cli/]Command line[/url]. 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 [url=http://phpbbmodders.net/about/svn/]over here[/url]. 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);

/**
 * constructor
 * 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');

$svn->svn_update();

trigger_error('SITE_UPDATED');

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 :).


EDIT:
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!

mtotheikle
New member
New member
Posts: 25
Joined: 11 Oct 2007, 03:03
Real name: Mike
Location: Spokane, WA

Re: functions_svn.php

Postby mtotheikle » 02 Jun 2008, 14:33

Thanks evil>3 I will be giving this a try soon, Hopefully my host has what I need. Lots of helpful information there. ;)

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David

Re: functions_svn.php

Postby harmlessgoat22 » 03 Jun 2008, 20:29

Dang, I've got shared :(
Image
That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian

Re: functions_svn.php

Postby Obsidian » 09 Jun 2008, 04:51

Argh...I don't want to install another program onto my computer...

Anyone know of a portable SVN client, then? :)

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: functions_svn.php

Postby igorw » 09 Jun 2008, 10:41

Yes, the SVN binaries to use with the commandline. The third article i linked to explains it. But that's only if you're really hardcore :mrgreen:.


Return to “Library”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests