From 6dd177d10406ff7fddc155da8d67cfde9c2b68cc Mon Sep 17 00:00:00 2001 From: aaronchen2k <462826@qq.com> Date: Sat, 1 Feb 2020 10:25:28 +0800 Subject: [PATCH] test svn sync --- module/ci/control.php | 8 ++++---- module/git/model.php | 4 ++-- module/jenkins/model.php | 2 +- module/repo/model.php | 31 +++++++++++++++++++++++++++++++ module/svn/model.php | 3 +++ 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/module/ci/control.php b/module/ci/control.php index cd5cdfd247..d398de2add 100644 --- a/module/ci/control.php +++ b/module/ci/control.php @@ -93,8 +93,8 @@ class ci extends control $this->view->position[] = html::a(inlink('browseJob'), $this->lang->ci->job); $this->view->position[] = $this->lang->ci->create; - $this->view->repoList = $this->loadModel('cirepo')->listForSelection("true"); - $this->view->jenkinsList = $this->loadModel('cijenkins')->listForSelection("true"); + $this->view->repoList = $this->loadModel('repo')->listForSelection("true"); + $this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true"); $this->display(); } @@ -120,8 +120,8 @@ class ci extends control $this->view->job = $job; - $this->view->repoList = $this->loadModel('cirepo')->listForSelection("true"); - $this->view->jenkinsList = $this->loadModel('cijenkins')->listForSelection("true"); + $this->view->repoList = $this->loadModel('repo')->listForSelection("true"); + $this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true"); $this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->ci->edit; $this->view->position[] = html::a(inlink('browseJob'), $this->lang->ci->job); diff --git a/module/git/model.php b/module/git/model.php index b8d0b2b0a8..19fb8cbff7 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -225,8 +225,8 @@ class gitModel extends model */ public function setRepos() { - $cirepo = $this->loadModel('cirepo'); - $repoObjs = $cirepo->listForSync("true"); + $repo = $this->loadModel('repo'); + $repoObjs = $repo->listForSync("SCM='Git'"); $gitRepos = []; $paths = []; diff --git a/module/jenkins/model.php b/module/jenkins/model.php index 1b3b76e0bd..5c731a9d64 100644 --- a/module/jenkins/model.php +++ b/module/jenkins/model.php @@ -1,6 +1,6 @@ dao->select('id, name')->from(TABLE_REPO) + ->where('deleted')->eq('0') + ->beginIF(!empty(whr))->andWhere('(' . $whr . ')')->fi() + ->orderBy(id) + ->fetchPairs(); + $repos[''] = ''; + return $repos; + } + + /** + * list repos for sync + * + * @return mixed + */ + public function listForSync($whr) + { + $repos = $this->dao->select('*')->from(TABLE_REPO) + ->where('deleted')->eq('0') + ->beginIF(!empty(whr))->andWhere('(' . $whr . ')')->fi() + ->orderBy(id) + ->fetchAll(); + return $repos; + } } diff --git a/module/svn/model.php b/module/svn/model.php index 3e3dd0a419..988baa4688 100644 --- a/module/svn/model.php +++ b/module/svn/model.php @@ -176,6 +176,9 @@ class svnModel extends model */ public function setRepos() { + $repo = $this->loadModel('repo'); + $repoObjs = $repo->listForSync("SCM='Subversion'"); + if(!$this->config->svn->repos) { echo "You must set one svn repo.\n";