PHP code to run SVN command to display file update records of a certain user_PHP tutorial

WBOY
Release: 2016-07-13 10:42:17
Original
905 people have browsed it

Copy code The code is as follows:

$user=trim($_GET['user' ]);
$d=$_GET['date'];
if(!$d){
$d=date('Ymd',time()-86400*14);
}
if(empty($user)){
echo "For example: svn_log.php?user=wang&date=20130118";
exit;
}

$cmd='/usr/bin/svn log -v -r {'.$d.'}:"HEAD" --username username--password password--no-auth-cache | sed -n "/'.$user.'/,/-----$/ p" 2>&1';

$p=dirname(__FILE__);

exec('cd '.$p,$output);

exec($cmd,$output);

$d=date('Y year m month d day',strtotime($d));
echo $user.'Since '.$d.':
';
echo '---------------------------------------------$out='';

krsort($output);

if(!empty($output)){
foreach($output as $v){
$p1=strpos($v,'/branch/');
$p2=strpos ($v,'/tg/');
if($p1!==false || $p2!==false){
if($p1!==false){
$v =substr($v,$p1+9);
}else{
$v=substr($v,$p2+4);
}
if($out=='' ){
$out=$v;
echo $v.'
';
}else{
if(strpos($out,$v)===false){
$out.=','.$v;
echo $v.'
';
}
}
}
}
}else{
echo "No file";
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/635838.htmlTechArticleCopy the code as follows: ?php $user=trim($_GET['user']); $d= $_GET['date']; if(!$d){ $d=date('Ymd',time()-86400*14); } if(empty($user)){ echo "For example: svn_log.php ?user=wang exit;...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!