* Adjust codes.
This commit is contained in:
@@ -126,12 +126,10 @@ class mr extends control
|
||||
{
|
||||
$gitlabUsers = $this->loadModel('gitlab')->getGitLabListByAccount();
|
||||
$giteaUsers = $this->gitea->getGiteaListByAccount();
|
||||
$gogsUsers = $this->gogs->getGiteaListByAccount();
|
||||
foreach($hosts as $hostID => $host)
|
||||
{
|
||||
if($host->type == 'gitLab' and isset($gitlabUsers[$hostID])) continue;
|
||||
if($host->type == 'gitea' and isset($giteaUsers[$hostID])) continue;
|
||||
if($host->type == 'gogs' and isset($gogsUsers[$hostID])) continue;
|
||||
|
||||
unset($hosts[$hostID]);
|
||||
}
|
||||
|
||||
@@ -217,10 +217,10 @@ class repoModel extends model
|
||||
$this->dao->insert(TABLE_REPO)->data($data, $skip = 'serviceToken')
|
||||
->batchCheck($this->config->repo->create->requiredFields, 'notempty')
|
||||
->batchCheckIF($data->SCM != 'Gitlab', 'path,client', 'notempty')
|
||||
->batchCheckIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceHost,serviceProject', 'notempty')
|
||||
->batchCheckIF($isPipelineServer, 'serviceHost,serviceProject', 'notempty')
|
||||
->batchCheckIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
|
||||
->checkIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceProject', 'unique', "`SCM` = '{$data->SCM}'")
|
||||
->checkIF(in_array($data->SCM, array('Git', 'Subversion')), 'path', 'unique', "`SCM` = '{$data->SCM}'")
|
||||
->checkIF($isPipelineServer, 'serviceProject', 'unique', "`SCM` = '{$data->SCM}'")
|
||||
->checkIF(!$isPipelineServer, 'path', 'unique', "`SCM` = '{$data->SCM}'")
|
||||
->autoCheck()
|
||||
->exec();
|
||||
|
||||
@@ -291,10 +291,10 @@ class repoModel extends model
|
||||
$this->dao->update(TABLE_REPO)->data($data, $skip = 'serviceToken')
|
||||
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
|
||||
->batchCheckIF($data->SCM != 'Gitlab', 'path,client', 'notempty')
|
||||
->batchCheckIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceHost,serviceProject', 'notempty')
|
||||
->batchCheckIF($isPipelineServer, 'serviceHost,serviceProject', 'notempty')
|
||||
->batchCheckIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
|
||||
->checkIF(in_array($data->SCM, array('Gitea', 'Gogs')), 'serviceProject', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
|
||||
->checkIF(in_array($data->SCM, array('Git', 'Subversion')), 'path', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
|
||||
->checkIF($isPipelineServer, 'serviceProject', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
|
||||
->checkIF(!$isPipelineServer, 'path', 'unique', "`SCM` = '{$data->SCM}' and `id` <> $id")
|
||||
->autoCheck()
|
||||
->where('id')->eq($id)->exec();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user