diff --git a/codepot/src/codepot/models/coderepomodel.php b/codepot/src/codepot/models/coderepomodel.php index b20c73af..fa0dc9b6 100644 --- a/codepot/src/codepot/models/coderepomodel.php +++ b/codepot/src/codepot/models/coderepomodel.php @@ -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; }; } diff --git a/codepot/src/codepot/models/gitmodel.php b/codepot/src/codepot/models/gitmodel.php index c7432358..baff85a1 100644 --- a/codepot/src/codepot/models/gitmodel.php +++ b/codepot/src/codepot/models/gitmodel.php @@ -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}"); } } diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index b87453ea..7ffa6a85 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -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; } }