* Fix error for create remote repo.
This commit is contained in:
+22
-20
@@ -102,27 +102,29 @@ $lang->gitlab->accessLevels[30] = 'Developer';
|
||||
$lang->gitlab->accessLevels[40] = 'Maintainer';
|
||||
$lang->gitlab->accessLevels[50] = 'Owner';
|
||||
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path = >["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path = >["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
$lang->gitlab->errorLang[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
$lang->gitlab->errorLang[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->errorLang[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
+22
-20
@@ -102,27 +102,29 @@ $lang->gitlab->accessLevels[30] = 'Developer';
|
||||
$lang->gitlab->accessLevels[40] = 'Maintainer';
|
||||
$lang->gitlab->accessLevels[50] = 'Owner';
|
||||
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
$lang->gitlab->errorLang[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
$lang->gitlab->errorLang[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->errorLang[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
+22
-28
@@ -102,35 +102,29 @@ $lang->gitlab->accessLevels[30] = 'Developer';
|
||||
$lang->gitlab->accessLevels[40] = 'Maintainer';
|
||||
$lang->gitlab->accessLevels[50] = 'Owner';
|
||||
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path = >["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path = >["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
$lang->gitlab->errorLang[9] = 'admin is a reserved name';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
$lang->gitlab->errorLang[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->errorLang[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
@@ -102,27 +102,29 @@ $lang->gitlab->accessLevels[30] = 'Developer';
|
||||
$lang->gitlab->accessLevels[40] = 'Maintainer';
|
||||
$lang->gitlab->accessLevels[50] = 'Owner';
|
||||
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
|
||||
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
$lang->gitlab->apiError[9] = 'admin is a reserved name';
|
||||
$lang->gitlab->apiError[10] = 'has already been taken';
|
||||
|
||||
$lang->gitlab->errorLang[0] = '私有分组的项目,可见性级别不能设为内部。';
|
||||
$lang->gitlab->errorLang[1] = '私有分组的项目,可见性级别不能设为公开。';
|
||||
$lang->gitlab->errorLang[2] = '密码太短(最少8个字符)';
|
||||
$lang->gitlab->errorLang[3] = "只能包含字母、数字、'.'-'和'.'。不能以'-'开头、以'.git'结尾或以'.atom'结尾。";
|
||||
$lang->gitlab->errorLang[4] = '分支名已存在。';
|
||||
$lang->gitlab->errorLang[5] = '保存失败,群组URL路径已经被使用。';
|
||||
$lang->gitlab->errorLang[6] = '保存失败,群组URL路径已经被使用。';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = '格式错误';
|
||||
$lang->gitlab->errorLang[9] = 'admin是保留名';
|
||||
$lang->gitlab->errorLang[0] = '私有分组的项目,可见性级别不能设为内部。';
|
||||
$lang->gitlab->errorLang[1] = '私有分组的项目,可见性级别不能设为公开。';
|
||||
$lang->gitlab->errorLang[2] = '密码太短(最少8个字符)';
|
||||
$lang->gitlab->errorLang[3] = "只能包含字母、数字、'.'-'和'.'。不能以'-'开头、以'.git'结尾或以'.atom'结尾。";
|
||||
$lang->gitlab->errorLang[4] = '分支名已存在。';
|
||||
$lang->gitlab->errorLang[5] = '保存失败,群组URL路径已经被使用。';
|
||||
$lang->gitlab->errorLang[6] = '保存失败,群组URL路径已经被使用。';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = '格式错误';
|
||||
$lang->gitlab->errorLang[9] = 'admin是保留名';
|
||||
$lang->gitlab->errorLang[10] = 'GitLab项目已存在';
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = '邮箱已存在';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = '用户名已存在';
|
||||
|
||||
@@ -2658,6 +2658,8 @@ class gitlabModel extends model
|
||||
{
|
||||
foreach($response->message as $field => $fieldErrors)
|
||||
{
|
||||
if(empty($fieldErrors)) continue;
|
||||
|
||||
if(is_string($fieldErrors))
|
||||
{
|
||||
$errorKey = array_search($fieldErrors, $this->lang->gitlab->apiError);
|
||||
|
||||
@@ -35,13 +35,16 @@ $config->repo->form->edit['desc'] = array('required' => false, 'type'
|
||||
|
||||
|
||||
$config->repo->form->createRepo = array();
|
||||
$config->repo->form->createRepo['product'] = array('required' => true, 'type' => 'array');
|
||||
$config->repo->form->createRepo['projects'] = array('required' => false, 'type' => 'array', 'default' => array());
|
||||
$config->repo->form->createRepo['product'] = array('required' => true, 'type' => 'array', 'default' => array(), 'filter' => 'join');
|
||||
$config->repo->form->createRepo['projects'] = array('required' => false, 'type' => 'array', 'default' => array(), 'filter' => 'join');
|
||||
$config->repo->form->createRepo['serviceHost'] = array('required' => false, 'type' => 'int');
|
||||
$config->repo->form->createRepo['namespace'] = array('required' => true, 'type' => 'string');
|
||||
$config->repo->form->createRepo['namespace'] = array('required' => true, 'type' => 'int');
|
||||
$config->repo->form->createRepo['name'] = array('required' => true, 'type' => 'string', 'filter' => 'trim');
|
||||
$config->repo->form->createRepo['desc'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->repo->form->createRepo['client'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->repo->form->createRepo['client'] = array('required' => false, 'type' => 'string', 'default' => 'git');
|
||||
$config->repo->form->createRepo['SCM'] = array('required' => false, 'type' => 'string', 'default' => 'Gitlab');
|
||||
$config->repo->form->createRepo['encoding'] = array('required' => false, 'type' => 'string', 'default' => 'utf-8');
|
||||
$config->repo->form->createRepo['encrypt'] = array('required' => false, 'type' => 'string', 'default' => 'plain');
|
||||
|
||||
$config->repo->form->createBranch = array();
|
||||
$config->repo->form->createBranch['repoID'] = array('required' => true, 'type' => 'int');
|
||||
|
||||
@@ -175,15 +175,14 @@ class repo extends control
|
||||
if($_POST)
|
||||
{
|
||||
/* Prepare data. */
|
||||
$formData = form::data($this->config->repo->form->createRepo);
|
||||
$isPipelineServer = in_array(strtolower($this->post->SCM), $this->config->repo->gitServiceList) ? true : false;
|
||||
$repo = $this->repoZen->prepareCreateRepo($formData, $isPipelineServer);
|
||||
$formData = form::data($this->config->repo->form->createRepo)->get();
|
||||
$repo = $this->repoZen->prepareCreateRepo($formData);
|
||||
|
||||
/* Create a repo. */
|
||||
if($repo) $repoID = $this->repo->createRepo($repo, $_POST['namespace']);
|
||||
if($repo) $repoID = $this->repo->createRepo($repo);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
if($this->post->SCM == 'Gitlab')
|
||||
if($formData->SCM == 'Gitlab')
|
||||
{
|
||||
/* Add webhook. */
|
||||
$repo = $this->repo->getByID($repoID);
|
||||
@@ -193,9 +192,8 @@ class repo extends control
|
||||
|
||||
$this->loadModel('action')->create('repo', $repoID, 'created');
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $repoID));
|
||||
$link = $this->repo->createLink('showSyncCommit', "repoID=$repoID&objectID=$objectID", '', false) . '#app=' . $this->app->tab;
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
|
||||
$link = $this->repo->createLink('showSyncCommit', "repoID=$repoID&objectID=$objectID");
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $link));
|
||||
}
|
||||
|
||||
$this->commonAction(0, $objectID);
|
||||
|
||||
@@ -216,11 +216,10 @@ class repoModel extends model
|
||||
* Create a repo.
|
||||
*
|
||||
* @param object $repo
|
||||
* @param int $namespace
|
||||
* @access public
|
||||
* @return int|false
|
||||
*/
|
||||
public function createRepo(object $repo, int $namespace): int|false
|
||||
public function createRepo(object $repo): int|false
|
||||
{
|
||||
$check = $this->repoTao->checkName($repo);
|
||||
if(!$check)
|
||||
@@ -230,13 +229,13 @@ class repoModel extends model
|
||||
}
|
||||
|
||||
$createRepoFunc = "create{$repo->SCM}Repo";
|
||||
$response = $this->$createRepoFunc($repo, $namespace);
|
||||
$response = $this->$createRepoFunc($repo, $repo->namespace);
|
||||
|
||||
$this->loadModel($repo->SCM);
|
||||
|
||||
if(!empty($response->id))
|
||||
{
|
||||
$this->loadModel('action')->create($repo->SCM . 'project', $response->id, 'created', '', $response->name);
|
||||
$this->loadModel('action')->create($repo->SCM . 'project', $response->id, 'created', '', $repo->name);
|
||||
$repo->path = $response->path;
|
||||
$repo->serviceProject = $response->serviceProject;
|
||||
$repo->extra = $response->extra;
|
||||
@@ -249,6 +248,7 @@ class repoModel extends model
|
||||
$repo->path = $path;
|
||||
}
|
||||
|
||||
unset($repo->namespace);
|
||||
$repoID = $this->create($repo, false);
|
||||
if(dao::isError())
|
||||
{
|
||||
@@ -2332,7 +2332,7 @@ class repoModel extends model
|
||||
* @access public
|
||||
* @return string|array|false
|
||||
*/
|
||||
public function getGroups(int|string $serverID, int|string $groupID = 0): string|array|false
|
||||
public function getGroups(int $serverID, int|string $groupID = 0): string|array|false
|
||||
{
|
||||
$server = $this->loadModel('pipeline')->getByID($serverID);
|
||||
$getGroupFunc = 'get' . $server->type . 'Groups';
|
||||
|
||||
+7
-60
@@ -81,74 +81,21 @@ class repoZen extends repo
|
||||
* 准备创建版本库的数据。
|
||||
* Prepare create repo data.
|
||||
*
|
||||
* @param form $formData
|
||||
* @param bool $isPipelineServer
|
||||
* @param object $repo
|
||||
* @access protected
|
||||
* @return object|false
|
||||
*/
|
||||
protected function prepareCreateRepo(form $formData, bool $isPipelineServer): object|false
|
||||
protected function prepareCreateRepo(object $repo): object|false
|
||||
{
|
||||
$serviceHost = $_POST['serviceHost'];
|
||||
$namespace = $_POST['namespace'];
|
||||
|
||||
$group = $this->repo->getGroups($serviceHost, $namespace);
|
||||
$server = $this->loadModel('pipeline')->getByID($serviceHost);
|
||||
|
||||
$_POST['path'] = "{$server->url}/{$group}/{$_POST['name']}";
|
||||
$_POST['encoding'] = 'utf-8';
|
||||
$_POST['encrypt'] = 'plain';
|
||||
$_POST['SCM'] = $this->getSCM($serviceHost);
|
||||
|
||||
if($this->config->inContainer || $this->config->inQuickon)
|
||||
{
|
||||
$formData->data->client = $_POST['client'] = $this->post->SCM == 'Subversion' ? 'svn' : 'git';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$this->checkClient()) return false;
|
||||
}
|
||||
if(!$this->checkConnection()) return false;
|
||||
|
||||
$repo = $formData
|
||||
->setIf($isPipelineServer, 'password', $this->post->serviceToken)
|
||||
->setIf($isPipelineServer, 'prefix', '')
|
||||
->skipSpecial('path,client,account,password,desc')
|
||||
->setDefault('path', $this->post->path)
|
||||
->setDefault('encoding', $this->post->encoding)
|
||||
->setDefault('encrypt', $this->post->encrypt)
|
||||
->setDefault('SCM', $this->post->SCM)
|
||||
->setDefault('product', '')->join('product', ',')
|
||||
->setDefault('projects', '')->join('projects', ',')
|
||||
->remove('namespace')
|
||||
->get();
|
||||
|
||||
$acl = $this->checkACL();
|
||||
if(!$acl) return false;
|
||||
$repo->acl = json_encode($acl);
|
||||
|
||||
if($repo->SCM == 'Subversion')
|
||||
{
|
||||
$scm = $this->app->loadClass('scm');
|
||||
$scm->setEngine($repo);
|
||||
$info = $scm->info('');
|
||||
$infoRoot = urldecode($info->root);
|
||||
$repo->prefix = empty($infoRoot) ? '' : trim(str_ireplace($infoRoot, '', str_replace('\\', '/', $repo->path)), '/');
|
||||
if($repo->prefix) $repo->prefix = '/' . $repo->prefix;
|
||||
}
|
||||
$repo->acl = json_encode($acl);
|
||||
|
||||
$group = $this->repo->getGroups($repo->serviceHost, $repo->namespace);
|
||||
$server = $this->loadModel('pipeline')->getByID($repo->serviceHost);
|
||||
$repo->path = "{$server->url}/{$group}/{$repo->name}";
|
||||
|
||||
if($isPipelineServer)
|
||||
{
|
||||
$serviceProject = $this->dao->select('*')->from(TABLE_REPO)
|
||||
->where('`SCM`')->eq($repo->SCM)
|
||||
->andWhere('`serviceHost`')->eq($repo->serviceHost)
|
||||
->andWhere('`serviceProject`')->eq($repo->serviceProject)
|
||||
->fetch();
|
||||
if($serviceProject)
|
||||
{
|
||||
dao::$errors['serviceProject'][] = $this->lang->repo->error->projectUnique;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $repo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user