mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-26 06:39:56 +09:00
#17588107 : added a feature setting user id and password for svn authentication
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5193 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ae1081df80
commit
c02b420613
10 changed files with 72 additions and 11 deletions
|
|
@ -14,8 +14,10 @@
|
|||
var $tmp_dir = '/tmp';
|
||||
|
||||
var $oXml = null;
|
||||
var $userid = null;
|
||||
var $passwd = null;
|
||||
|
||||
function Svn($url, $svn_cmd='/usr/bin/svn', $diff_cmd='/usr/bin/diff') {
|
||||
function Svn($url, $svn_cmd='/usr/bin/svn', $diff_cmd='/usr/bin/diff', $userid=null, $passwd=null) {
|
||||
if(substr($url,-1)!='/') $url .= '/';
|
||||
$this->url = $url;
|
||||
|
||||
|
|
@ -26,14 +28,29 @@
|
|||
$this->tmp_dir = _XE_PATH_.'files/cache/tmp';
|
||||
if(!is_dir($this->tmp_dir)) FileHandler::makeDir($this->tmp_dir);
|
||||
|
||||
$this->userid = $userid;
|
||||
$this->passwd = $passwd;
|
||||
|
||||
$this->oXml = new XmlParser();
|
||||
}
|
||||
|
||||
function _getAuthInfo()
|
||||
{
|
||||
if($this->userid && $this->passwd)
|
||||
{
|
||||
return sprintf("--username %s --password %s", $this->userid, $this->passwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function getStatus($path = '/') {
|
||||
if(substr($path,0,1)=='/') $path = substr($path,1);
|
||||
if(strpos($path,'..')!==false) return;
|
||||
|
||||
$command = sprintf("%s --non-interactive --config-dir %s log --xml --limit 1 %s%s", $this->svn_cmd, $this->tmp_dir, $this->url, $path);
|
||||
$command = sprintf("%s --non-interactive --config-dir %s log --xml --limit 1 %s %s%s", $this->svn_cmd, $this->tmp_dir, $this->_getAuthInfo(), $this->url, $path);
|
||||
$buff = $this->execCmd($command, $error);
|
||||
$xmlDoc = $this->oXml->parse($buff);
|
||||
|
||||
|
|
@ -53,8 +70,9 @@
|
|||
if(strpos($path,'..')!==false) return;
|
||||
|
||||
$command = sprintf(
|
||||
'%s --non-interactive --config-dir %s list %s%s%s',
|
||||
'%s --non-interactive %s --config-dir %s list %s%s%s',
|
||||
$this->svn_cmd,
|
||||
$this->_getAuthInfo(),
|
||||
$this->tmp_dir,
|
||||
$this->url,
|
||||
$path,
|
||||
|
|
@ -95,8 +113,9 @@
|
|||
if(strpos($path,'..')!==false) return;
|
||||
|
||||
$command = sprintf(
|
||||
'%s --non-interactive --config-dir %s cat %s%s%s',
|
||||
'%s --non-interactive %s --config-dir %s cat %s%s%s',
|
||||
$this->svn_cmd,
|
||||
$this->_getAuthInfo(),
|
||||
$this->tmp_dir,
|
||||
$this->url,
|
||||
$path,
|
||||
|
|
@ -179,15 +198,16 @@
|
|||
|
||||
function getComp($path, $brev, $erev) {
|
||||
if(!$brev) {
|
||||
$command = sprintf('%s --non-interactive --config-dir %s log --xml --limit 2 %s%s@%d', $this->svn_cmd, $this->tmp_dir, $this->url, $path, $erev);
|
||||
$command = sprintf('%s --non-interactive %s --config-dir %s log --xml --limit 2 %s%s@%d', $this->svn_cmd, $this->_getAuthInfo(), $this->tmp_dir, $this->url, $path, $erev);
|
||||
$buff = $this->execCmd($command, $error);
|
||||
$xmlDoc = $this->oXml->parse($buff);
|
||||
$brev = $xmlDoc->log->logentry[1]->attrs->revision;
|
||||
if(!$brev) return;
|
||||
}
|
||||
|
||||
$command = sprintf('%s --non-interactive --config-dir %s diff %s%s@%d %s%s@%d',
|
||||
$command = sprintf('%s --non-interactive %s --config-dir %s diff %s%s@%d %s%s@%d',
|
||||
$this->svn_cmd,
|
||||
$this->_getAuthInfo(),
|
||||
$this->tmp_dir,
|
||||
$this->url,
|
||||
$path,
|
||||
|
|
@ -250,8 +270,9 @@
|
|||
if(strpos($path,'..')!==false) return;
|
||||
|
||||
$command = sprintf(
|
||||
'%s --non-interactive --config-dir %s log --xml %s %s %s %s%s',
|
||||
'%s --non-interactive %s --config-dir %s log --xml %s %s %s %s%s',
|
||||
$this->svn_cmd,
|
||||
$this->_getAuthInfo(),
|
||||
$this->tmp_dir,
|
||||
$quiet?'--quiet':'--verbose',
|
||||
$limit?'--limit '.$limit:'',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue