[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: PHP, Subversion and Hook Scripts

From: swdev <swdev1_at_gmail.com>
Date: 2005-03-21 09:36:53 CET

Sam D

Thanks for the response.

I am hoping (when I get some free time :) ) to create a PHP extension
that will call the SVN libraries directly rather than using the 'exec'
or 'popen' PHP calls.

Thanks for the sample code - it definitley points me in the right direction

swdev

On Sun, 20 Mar 2005 11:55:48 -0700, Samuel DeVore <sdevore@gmail.com> wrote:
> > 1) Can I use PHP as I don't have either PERL or PYTHON installed on my
> > system and I don't know either language?
> >
> > 2) Are there any further examples of the kind of things these hook scripts
> > can do?
> >
> > 3) Is there a website with a collection of scripts?
> >
> > 4) Has anyone looked at creating a PHP extension module (library) that
> > can interface directly to the Subverion libraries?
> >
> > 5) Would anyone have any ideas as to how to go about implementing this?
> >
> >
>
> I've played a little with the PEAR library for SVN
> http://pear.php.net/package/VersionControl_SVN
> but ended up without it, the sample should give you an idea.
>
> Sam D
>
> here is a little sample
>
> ==start==
> #!/usr/local/php/bin/php
> <?php
>
> require_once 'Console/Getargs.php';
> require_once 'Mail.php';
> $args =& Console_Getargs::factory();
> $mailer =& Mail::factory('mail');
> $to = 'comitEmail@example.com';
> $headers = array('Subject'=>'[SVN-Com] '.$argv[1]."
> #".$argv[2],'From'=>'svn@example.com');
> $body =array();
> exec('/usr/local/bin/svnlook info /svn/uscRep',$info);
>
> exec('/usr/local/bin/svnlook changed /svn/uscRep',$files);
>
> $body = array_merge($body,$argv);
> $s = "SVN Post-commit Email\n";
> $s .= "=====================\n";
> $s .= "User: ".$info[0]."\n";
> $s .= "Time: ".$info[1]."\n";
> $s .= "Repository: ".$argv[1]." Revision #".$argv[2]."\n";
>
> $s .= "\nMessage:\n";
> $num = count($info);
> for ( $i = 3; $i < $num; $i++ )
> {
> $s .= $info[$i]."\n";
> }
> $s .= "=====================\n";
> foreach ( $files as $file )
> {
> $s .= $file."\n";
> }
>
> $res = $mailer->send($to,$headers, $s);
> ?>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Mar 21 09:39:17 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.