diff --git a/module/tree/control.php b/module/tree/control.php index d1d3686718..eaf069b278 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -419,10 +419,12 @@ class tree extends control * @param string $returnType * @param string $fieldID * @param bool $needManage + * @param string $extra + * @param int $currentModuleID * @access public * @return string the html select string. */ - public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $fieldID = '', $needManage = false, $extra = '') + public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $fieldID = '', $needManage = false, $extra = '', $currentModuleID = 0) { if($viewType == 'task') { @@ -448,7 +450,7 @@ class tree extends control $changeFunc = ''; if($viewType == 'task' or $viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'"; $field = $fieldID ? "modules[$fieldID]" : 'module'; - $output = html::select("$field", $optionMenu, '', "class='form-control' $changeFunc"); + $output = html::select("$field", $optionMenu, $currentModuleID, "class='form-control' $changeFunc"); if(count($optionMenu) == 1 and $needManage) { $output .= ""; From 96d2f5a07d48491a92d3ee80452bec9df1ba9086 Mon Sep 17 00:00:00 2001 From: Guanxiying Date: Wed, 28 Apr 2021 09:56:44 +0800 Subject: [PATCH 11/12] * Fix comments of public funtions. --- test/init.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/init.php b/test/init.php index 7fbea75295..93c3aa8626 100644 --- a/test/init.php +++ b/test/init.php @@ -29,6 +29,13 @@ $tester = $app->loadCommon(); $config->zendataRoot = dirname(__FILE__) . DS . 'zendata'; $config->zdPath = "/usr/local/zd/zd"; +/** + * Save variable to $_result. + * + * @param mix $result + * @access public + * @return bool true + */ function run($result) { global $_result; @@ -36,6 +43,14 @@ function run($result) return true; } +/** + * Print expect data. + * + * @param int $key + * @param string $delimiter + * @access public + * @return void + */ function expect($key, $delimiter = ',') { global $_result; @@ -66,6 +81,15 @@ function expect($key, $delimiter = ',') echo "\n"; } +/** + * Import data create by zendata to one table. + * + * @param string $table + * @param string $yaml + * @param int $count + * @access public + * @return void + */ function zdImport($table, $yaml, $count = 10) { chdir(dirname(__FILE__)); From 3b8dd3db340ccc4a56d028a4f7b0e1a8f1f7f0c3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 28 Apr 2021 10:53:52 +0800 Subject: [PATCH 12/12] * fix bug #12050. --- lib/scm/gitlab.class.php | 11 +++++++++-- module/repo/control.php | 2 +- module/repo/model.php | 7 +++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index ecf9871531..aad2bbb639 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -501,7 +501,8 @@ class gitlab if($version) { $lastCommit = $this->getSingleCommit($version); - if(empty($lastCommit)) return array(); + if(!isset($lastCommit->committed_date)) return array('commits' => array(), 'files' => array()); + $params['until'] = $lastCommit->committed_date; } @@ -644,7 +645,13 @@ class gitlab $api = ltrim($api, '/'); $api = $this->root . $api . '?' . http_build_query($params); - $response = file_get_contents($api); + $response = commonModel::http($api); + if(!empty(commonModel::$requestErrors)) + { + commonModel::$requestErrors = array(); + return array(); + } + return json_decode($response); } diff --git a/module/repo/control.php b/module/repo/control.php index 9580fd9d4f..411c1b0bc5 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -867,7 +867,7 @@ class repo extends control set_time_limit(0); $repo = $this->repo->getRepoByID($repoID); if(empty($repo)) die(); - //if($repo->synced) die('finish'); + if($repo->synced) die('finish'); $this->commonAction($repoID); $this->scm->setEngine($repo); diff --git a/module/repo/model.php b/module/repo/model.php index fd22ec2338..03ec69715a 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -281,15 +281,18 @@ class repoModel extends model $repo = $this->getRepoByID($id); $data = fixer::input('post') + ->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken) + ->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost) + ->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject) ->setDefault('client', 'svn') ->setDefault('prefix', $repo->prefix) ->setDefault('product', '') - ->setIF($this->post->path != $repo->path, 'synced', 0) ->skipSpecial('path,client,account,password') ->join('product', ',') ->get(); if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject); + if($data->path != $repo->path) $data->synced = 0; $data->acl = empty($data->acl) ? '' : json_encode($data->acl); @@ -313,7 +316,7 @@ class repoModel extends model $this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabHost,gitlabToken,gitlabProject') ->batchCheck($this->config->repo->edit->requiredFields, 'notempty') ->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty') - ->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty') + ->checkIF($data->SCM == 'GitLab', 'extra', 'notempty') ->autoCheck() ->where('id')->eq($id)->exec();