Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getRepoName($repo) {
- return strtoupper(str_replace('/', '', str_replace('/svn/svn.localhost/', '', $repo)));
- }
- require_once('phpmail/class.phpmailer.php');
- $repository = isset($argv[1]) ? $argv[1] : '';
- $revision = isset($argv[2]) ? $argv[2] : '';
- $author = strtoupper(exec('svnlook author ' . $repository));
- $changed = exec('svnlook changed ' . $repository);
- $comments = exec('svnlook log ' . $repository);
- $diff = '';
- $fp = popen('svnlook diff ' . $repository, "r");
- while(!feof($fp)) {
- $diff .= fread($fp, 1024);
- flush();
- }
- pclose($fp);
- $body = "
- Hi,\n\n
- $author has just committed
- revision $revision in " . getRepoName($repository) . "
- and said \n\n$comments.
- \n\n\n\n
- The following files have changed :\n\n$changed
- \n\n\n\nThe changelog is given below $diff";
- $mail = new PHPMailer();
- $mail->From = 'svn@localhost';
- $mail->FromName = 'SVN Server';
- $mail->AddAddress('repo.admin@localhost', 'Repo Admin');
- $mail->Subject = 'SVN Commit - ' . getRepoName($repository) . ' - Revision ' . $revision;
- $mail->Body = $body;
- if(!$mail->Send()) {
- echo "Error sending: " . $mail->ErrorInfo;;
- }
- ?>
Add Comment
Please, Sign In to add comment