|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-01-18 22:20 UTC] eflash at gmx dot net
Description: ------------ Any plans for at least listing the available functions, and providing a test sample? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 03:00:02 2025 UTC |
<html> <h2>PHP cvsclient extension sample</h2> <pre> <?php // Sample to test the cvsclient extension // To view source call with: tstcvsclient.php?viewsource=1 // v0.10 20-Jan-2005, by G. Knauf <efash@gmx.net> // Connect to CVS pserver // resource cvsclient_connect(string server, string cvsroot[, int port]) // Authenticate to the CVS pserver // bool cvsclient_login(resource cvsclient, string username, string password) // Retrieve specified <revision> (can also be tag or branch) of filename referred to by <path> in <module> */ // mixed cvsclient_retrieve(resource cvsclient, string module, string path[, string saveto[, string revision]]) // Retrieve log message for a particular revision // proto string cvsclient_log(resource cvsclient, string module, string filepath[, string revision]) if ($_GET['viewsource']) { highlight_file($_SERVER['SCRIPT_FILENAME']); die; }; extension_loaded('cvsclient') or die ("Error: cvsclient extension not loaded!"); $server = 'cvs.php.net'; $cvsroot = '/repository'; $username = 'cvsread'; if( ! isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ) { echo "<font color=red><b>Warning! This connection is unsecure - use HTTPS instead!</b></font><p>\n"; } if (isset($_POST['submit'])) { $server = $_POST['cvsserver']; $cvsroot = $_POST['cvsroot']; $username = $_POST['username']; $password = $_POST['password']; $cvsclient = cvsclient_connect($server, $cvsroot) or die("Can't connect to '$server'"); if (cvsclient_login($cvsclient, $username, $password)) { echo "<font color=green>Successfully logged into '$server'!</font>\n"; } else { echo "<font color=red>Failed to login to '$server'!</font>\n"; } echo "</pre>\n"; } else { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table> <tr><td><b>Enter Server: </b></td> <td><input type="cvsserver" name="cvsserver" size="30" value="<?php echo $server; ?>"></td></tr> <tr><td><b>Enter CVSROOT: </b></td> <td><input type="cvsroot" name="cvsroot" size="90" value="<?php echo $cvsroot; ?>"></td></tr> <tr><td><b>Enter Username: </b></td> <td><input type="username" name="username" size="30" value="<?php echo $username; ?>"></td></tr> <tr><td><b>Enter Password: </b></td> <td><input type="password" name="password" size="30"></td></tr> </table> <p><input type="submit" name="submit" value="submit"> </form> <?php } ?> </html>Hi Pollita, your timeframe seems not better than mine; I'm in far too many projects involved, and also I'm somwhat new to php extension coding.... also I would now prefer to make focus on a svnclient; that seems far easier cause we can call into libsvn... below a new sample with which I was at least able to retrieve a file; but it's still not clear for me how I can retieve a file listing...?? Would be great if you could take a look, perhaps add some lines, and check into CVS test folder. ========================================================== <html> <h2>PHP cvsclient extension sample</h2> <pre> <?php // Sample to test the cvsclient extension // To view source call with: tstcvsclient.php?viewsource=1 // v0.11 21-Jan-2005, by G. Knauf <efash@gmx.net> // Connect to CVS pserver // resource cvsclient_connect(string server, string cvsroot[, int port]) // Authenticate to the CVS pserver // bool cvsclient_login(resource cvsclient, string username, string password) // Retrieve specified <revision> (can also be tag or branch) of filename referred to by <path> in <module> */ // mixed cvsclient_retrieve(resource cvsclient, string module, string path[, string saveto[, string revision]]) // Retrieve log message for a particular revision // proto string cvsclient_log(resource cvsclient, string module, string filepath[, string revision]) if ($_GET['viewsource']) { highlight_file($_SERVER['SCRIPT_FILENAME']); die; }; extension_loaded('cvsclient') or die ("Error: cvsclient extension not loaded!"); $server = 'cvs.php.net'; $cvsroot = '/repository'; $username = 'cvsread'; $password = 'cvsread'; $module = '/pecl/cvsclient'; $path = 'package.xml'; $saveto = '/tmp/pecl'; if( ! isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ) { echo "<font color=red><b>Warning! This connection is unsecure - use HTTPS instead!</b></font><p>\n"; } if (isset($_POST['submit'])) { $server = $_POST['server']; $cvsroot = $_POST['cvsroot']; $module = $_POST['module']; $path = $_POST['path']; $username = $_POST['username']; $password = $_POST['password']; $cvsclient = cvsclient_connect($server, $cvsroot) or die("Can't connect to '$server'"); if (cvsclient_login($cvsclient, $username, $password)) { echo "<font color=green>Successfully logged into '$server'!</font>\n\n"; //$r = cvsclient_retrieve($cvsclient, $module, $path[, string saveto[, string revision]]) echo "Trying to retreive '$path' from '$module'...\n"; if ($r = cvsclient_retrieve($cvsclient, $module, $path)) { echo "<font color=blue>\n"; echo "<hr>\n$r\n<hr>\n"; echo "</font>\n"; } else { echo "<font color=red>Failed to retrieve '$path' from '$module'!</font>\n"; } } else { echo "<font color=red>Failed to login to '$server'!</font>\n"; } echo "</pre>\n"; } else { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table> <tr><td><b>Enter Server: </b></td> <td><input type="text" name="server" size="40" value="<?php echo $server; ?>"></td></tr> <tr><td><b>Enter CVSROOT: </b></td> <td><input type="text" name="cvsroot" size="40" value="<?php echo $cvsroot; ?>"></td></tr> <tr><td><b>Enter Module: </b></td> <td><input type="text" name="module" size="40" value="<?php echo $module; ?>"></td></tr> <tr><td><b>Enter Filepath: </b></td> <td><input type="text" name="path" size="40" value="<?php echo $path; ?>"></td></tr> <tr><td><b>Enter Username: </b></td> <td><input type="username" name="username" size="40" value="<?php echo $username; ?>"></td></tr> <tr><td><b>Enter Password: </b></td> <td><input type="password" name="password" size="40" value="<?php echo $password; ?>"></td></tr> </table> <p><input type="submit" name="submit" value="submit"> </form> <?php } ?> </html>