Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

186 Chapter 5 Basic Web Application Strategies Automated

Filed under: PHP Web Hosting — webmaster @ 20:21

CVS: Concurrent Versions System 187 To send mail to John and Jane, the following line could be used: ^f-api /bin/mail -s CVS update: %s -c john jane But what if the commit message should also be logged to a file? CVS matches only the first entry for a directory, so specifying another line for ^f-api wouldn t help. Without doubt, a shell script could handle it, but what if the routine should be extended to log the message to a database later? Listing 5.2 shows how to solve this problem with PHP. In the loginfo file, it s called like this: phpBook /usr/local/cvsroot/CVSROOT/Commit_Info.php3 . /usr/local/cvsroot/CVSROOT/logs/default.log CVS update %s till tobias This line tells CVS to invoke the script Commit_Info.php3 when a commit happens for the phpBook repository.The script gets invoked with at least three arguments (four in our example): n A filename where a log summary for this commit should be stored. n The subject line of the email message. n The recipient(s). One recipient email address is required; simply provide a list of addresses as shown in the preceding example if you want to send the message to more recipients. Listing 5.2 Mail and log a commit info message. // Check for correct number of arguments if(count($argv) < 4) { print( Usage: Commit_Info.php3 logfile subject to-address [to-address ...]n ); print( n ); print( A script to log and mail CVS commit messages.n ); print( From Web Application Development with PHPn ); print( Tobias Ratschiller and Till Gerken. .Copyright (c) 2000, New Riders Publishingn ); exit; } // First argument is the logfilename $logfile = $argv[1]; // Second argument is the mail s subject $subject = $argv[2]; // Initialize the body variable $body = ; // Get the commit message passed via stdin $fp = fopen( php://stdin , r ) or die( Fatal Error: could not read from stdin. ); while(!feof($fp)) continues

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Inexpensive Web Hosting services

1 Comment

  1. zoloft sexual side effects…

    news…

    Trackback by zoloft sexual side effects — 18. December 2007. @ 18:06

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Cheap Web Hosting