fixed minor flaws in subversionmodel.php

added empty gitmodel.php for future work on git
This commit is contained in:
hyung-hwan 2018-11-30 07:05:22 +00:00
parent e839933b60
commit 328ef3829c
4 changed files with 176 additions and 1 deletions

View File

@ -3,6 +3,7 @@ www_DATA = \
codemodel.php \
dbloginmodel.php \
filemodel.php \
gitmodel.php \
index.html \
issuemodel.php \
ldaploginmodel.php \

View File

@ -148,6 +148,7 @@ www_DATA = \
codemodel.php \
dbloginmodel.php \
filemodel.php \
gitmodel.php \
index.html \
issuemodel.php \
ldaploginmodel.php \

View File

@ -0,0 +1,166 @@
<?php
class GitModel extends Model
{
protected $errmsg = '';
function capture_error ($errno, $errmsg)
{
$this->errmsg = $errmsg;
}
function getErrorMessage ()
{
return $this->errmsg;
}
function GitModel ()
{
parent::Model ();
}
private function _canonical_path($path)
{
$canonical = preg_replace('|/\.?(?=/)|','',$path);
while (($collapsed = preg_replace('|/[^/]+/\.\./|','/',$canonical,1)) !== $canonical)
{
$canonical = $collapsed;
}
$canonical = preg_replace('|^/\.\./|','/',$canonical);
if ($canonical != '/' && substr($canonical, -1) == '/')
{
// if the last character is / and it's not the only character, remove it
$canonical = substr ($canonical, 0, -1);
}
return $canonical;
}
function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD, $type_and_name_only = FALSE)
{
return FALSE;
}
function getBlame ($projectid, $path, $rev = SVN_REVISION_HEAD)
{
return FALSE;
}
function getHistory ($projectid, $path, $rev = SVN_REVISION_HEAD)
{
return FALSE;
}
function storeFile ($projectid, $path, $committer, $commit_message, $text)
{
return FALSE;
}
function importFiles ($projectid, $path, $committer, $commit_message, $files, $uploader)
{
return FALSE;
}
function deleteFiles ($projectid, $path, $committer, $commit_message, $files)
{
return FALSE;
}
function renameFiles ($projectid, $path, $committer, $commit_message, $files)
{
return FALSE;
}
function getRevHistory ($projectid, $path, $rev)
{
return FALSE;
}
//
// Given a path name at the HEAD revision, it compares the file
// between two revisions given. The actual path name at a given
// revision can be different from the path name at the HEAD revision.
//
// $file - path name at the HEAD revision
// $rev1 - new revision number
// $rev2 - old revision number
//
function getDiff ($projectid, $path, $rev1, $rev2, $full = FALSE)
{
return FALSE;
}
function getPrevRev ($projectid, $path, $rev)
{
return FALSE;
}
function getNextRev ($projectid, $path, $rev)
{
return FALSE;
}
function getHeadRev ($projectid, $path, $rev)
{
return FALSE;
}
function getRevProp ($projectid, $rev, $prop)
{
return FALSE;
}
function setRevProp ($projectid, $rev, $prop, $propval, $user)
{
return FALSE;
}
function killRevProp ($projectid, $rev, $prop, $user)
{
return FALSE;
}
function mapRevPropToRev ($projectid, $revprop_name)
{
return FALSE;
}
function findRevWithRevProp ($projectid, $revprop_name, $revprop_value)
{
return FALSE;
}
function listProps ($projectid, $path, $rev)
{
return FALSE;
}
function getProp ($projectid, $path, $rev, $prop)
{
return FALSE;
}
function clocRevByLang ($projectid, $path, $rev)
{
return FALSE;
}
function clocRevByFile ($projectid, $path, $rev)
{
return FALSE;
}
function revisionGraph ($projectid, $path, $rev = SVN_REVISION_HEAD)
{
return FALSE;
}
function zipSubdir ($projectid, $path, $rev, $topdir)
{
return FALSE;
}
}
?>

View File

@ -343,7 +343,7 @@ class SubversionModel extends Model
function storeFile ($projectid, $path, $committer, $commit_message, $text)
{
$errmsg = '';
$this->errmsg = '';
//$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}";
$canon_path = $this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
@ -1316,6 +1316,7 @@ class SubversionModel extends Model
function getRevProp ($projectid, $rev, $prop)
{
$this->errmsg = '';
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
set_error_handler (array ($this, 'capture_error'));
@ -1326,6 +1327,7 @@ class SubversionModel extends Model
function setRevProp ($projectid, $rev, $prop, $propval, $user)
{
$this->errmsg = '';
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
set_error_handler (array ($this, 'capture_error'));
@ -1342,6 +1344,7 @@ class SubversionModel extends Model
function killRevProp ($projectid, $rev, $prop, $user)
{
$this->errmsg = '';
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
set_error_handler (array ($this, 'capture_error'));
@ -1359,6 +1362,7 @@ class SubversionModel extends Model
function mapRevPropToRev ($projectid, $revprop_name)
{
$this->errmsg = '';
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
set_error_handler (array ($this, 'capture_error'));
@ -1384,6 +1388,7 @@ class SubversionModel extends Model
function findRevWithRevProp ($projectid, $revprop_name, $revprop_value)
{
$this->errmsg = '';
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
set_error_handler (array ($this, 'capture_error'));
@ -1409,6 +1414,7 @@ class SubversionModel extends Model
function listProps ($projectid, $path, $rev)
{
$this->errmsg = '';
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
@ -1436,6 +1442,7 @@ class SubversionModel extends Model
function getProp ($projectid, $path, $rev, $prop)
{
$this->errmsg = '';
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention