cvs2rss.php
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
cvs2rss.php [2006/11/13 12:40] – 209.8.22.198 | cvs2rss.php [2006/11/13 13:32] (current) – old revision restored andi | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CVS2RSS ====== | ||
+ | Sometimes you want to monitor changes in a CVS server were you have access to install a script like [[http:// | ||
+ | |||
+ | You need the [[http:// | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | //you need the feedcreator class from http:// | ||
+ | include(" | ||
+ | |||
+ | $CVS_BIN | ||
+ | $CVS_ROOT = ': | ||
+ | $CVS_REP | ||
+ | $CVS_DATE = '1 days ago'; #This is to limit the amount of data returned (CVS Date Syntax) | ||
+ | $CVS_LINK = ' | ||
+ | $FILE = ' | ||
+ | |||
+ | //Create the feed object | ||
+ | $rss = new UniversalFeedCreator(); | ||
+ | $rss-> | ||
+ | $rss-> | ||
+ | $rss-> | ||
+ | $rss-> | ||
+ | # | ||
+ | |||
+ | //make params safe | ||
+ | $CVS_ROOT = escapeshellarg($CVS_ROOT); | ||
+ | $CVS_REP | ||
+ | $CVS_DATE = escapeshellarg($CVS_DATE); | ||
+ | |||
+ | //fetch data | ||
+ | $changes = cvs_commits(); | ||
+ | |||
+ | //add items if any | ||
+ | foreach($changes as $change){ | ||
+ | $fields = preg_split(' | ||
+ | |||
+ | ($fields[7] == ' | ||
+ | |||
+ | $file = $dir.'/' | ||
+ | |||
+ | $item = new FeedItem(); | ||
+ | $item-> | ||
+ | $item-> | ||
+ | $item-> | ||
+ | $item-> | ||
+ | $item-> | ||
+ | $rss-> | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | $rss-> | ||
+ | //endof main | ||
+ | |||
+ | |||
+ | |||
+ | // fetch commit data | ||
+ | function cvs_commits(){ | ||
+ | global $CVS_BIN; | ||
+ | global $CVS_ROOT; | ||
+ | global $CVS_REP; | ||
+ | global $CVS_DATE; | ||
+ | |||
+ | $changes = array(); | ||
+ | $cmd = " | ||
+ | $changes = split(" | ||
+ | |||
+ | if(count($changes) == 0 || $changes[0] == 'No records selected.' | ||
+ | return array(); | ||
+ | } | ||
+ | return $changes; | ||
+ | } | ||
+ | |||
+ | // fetch file description | ||
+ | function cvs_details($file, | ||
+ | global $CVS_BIN; | ||
+ | global $CVS_ROOT; | ||
+ | |||
+ | @set_time_limit(30); | ||
+ | |||
+ | $file = escapeshellarg($file); | ||
+ | $cmd = " | ||
+ | |||
+ | $out = shell_exec($cmd); | ||
+ | |||
+ | if(preg_match(' | ||
+ | $out = trim($matches[1]); | ||
+ | $out = trim($out,' | ||
+ | $out = nl2br($out); | ||
+ | } | ||
+ | return $out; | ||
+ | } | ||
+ | |||
+ | |||
+ | // realname for cvs flags | ||
+ | function cvs_flags($flag){ | ||
+ | switch ($flag){ | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | case ' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ?> | ||
+ | </ |
cvs2rss.php.txt · Last modified: 2006/11/13 13:32 by andi