fixed some wrong uses of

This commit is contained in:
hyung-hwan 2021-02-12 17:35:03 +00:00
parent bae3f6aec0
commit 945fb1ca9a
3 changed files with 15 additions and 7 deletions

View File

@ -45,7 +45,7 @@ class CodeRepoModel extends Model
if (self::_deleteDirectory($dir . "/" . $item) === FALSE)
{
chmod($dir . "/" . $item, 0777);
if (self::deleteDirectory($dir . "/" . $item) === FALSE) return FALSE;
if (self::_deleteDirectory($dir . "/" . $item) === FALSE) return FALSE;
};
}

View File

@ -3,7 +3,7 @@
$CI = &get_instance();
$CI->load->model('CodeRepoModel');
class GitModel extends CodeRepoModel
class SubversionModel extends CodeRepoModel
{
function __construct ()
{
@ -156,12 +156,20 @@ class GitModel extends CodeRepoModel
static function createRepo ($projectid, $repodir, $cfgdir, $api)
{
$projdir = "{$repodir}/{$projectid}";
if (@git_repository_init($projdir, TRUE) === FALSE) return FALSE;
try
{
@Git2\Repository::init($projdir, FALSE);
return TRUE;
}
catch (Exception $x)
{
return FALSE;
}
}
static function deleteRepo ($projectid, $repodir)
{
return $this->deleteDirectory("{$repodir}/{$projectid}");
return self::_deleteDirectory("{$repodir}/{$projectid}");
}
}

View File

@ -2223,13 +2223,13 @@ class SubversionModel extends CodeRepoModel
$contents = @file_get_contents("{$cfgdir}/${hook}");
if ($contents === FALSE)
{
$this->deleteDirectory ($projdir);
self::_deleteDirectory ($projdir);
return FALSE;
}
if (@file_put_contents("{$repodir}/${hook}", str_replace('%API%', $api, $contents)) === FALSE)
{
$this->deleteDirectory ($projdir);
self::_deleteDirectory ($projdir);
return FALSE;
}
@ -2237,7 +2237,7 @@ class SubversionModel extends CodeRepoModel
if (@chmod("{$repodir}/{$hook}", 0755) === FALSE ||
@symlink("../../{$hook}", "{$repodir}/{$projectid}/hooks/${hook}") === FALSE)
{
$this->deleteDirectory ($projdir);
self::_deleteDirectory ($projdir);
return FALSE;
}
}