From 8431d0f6c2d5c5a07347e855c4d50e4e9a4721fb Mon Sep 17 00:00:00 2001 From: dingguodong Date: Fri, 25 Jun 2021 13:10:42 +0800 Subject: [PATCH] - Remove deprecated label funcs and codes. --- module/gitlab/model.php | 59 --------------------------------------- module/pipeline/model.php | 4 --- 2 files changed, 63 deletions(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 4732dabbaf..08cab87e6a 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -499,65 +499,6 @@ class gitlabModel extends model return $urls; } - /** - * Check if predefined label exist in project. - * - * @param int $gitlabID - * @param int $projectID - * @access public - * @return void - */ - public function isLabelExists($gitlabID, $projectID) - { - $labels = $this->apiGetLabels($gitlabID, $projectID); - if(empty($labels)) return false; - foreach($labels as $label) - { - if(strpos($label->name, $this->config->gitlab->taskLabel->name) == 0) return true; - if(strpos($label->name, $this->config->gitlab->bugLabel->name) == 0) return true; - if(strpos($label->name, $this->config->gitlab->storyLabel->name) == 0) return true; - } - - return false; - } - - /** - * Create predefined labels for project. - * - * @param int $gitlabID - * @param int $projectID - * @access public - * @return void - */ - public function initLabels($gitlabID, $projectID) - { - if($this->isLabelExists($gitlabID, $projectID)) return true; - - $taskLabel = new stdclass(); - $taskLabel->name = $this->config->gitlab->taskLabel->name; - $taskLabel->description = $this->config->gitlab->taskLabel->description; - $taskLabel->color = $this->config->gitlab->taskLabel->color; - $taskLabel->priority = $this->config->gitlab->taskLabel->priority; - - $bugLabel = new stdclass(); - $bugLabel->name = $this->config->gitlab->bugLabel->name; - $bugLabel->description = $this->config->gitlab->bugLabel->description; - $bugLabel->color = $this->config->gitlab->bugLabel->color; - $bugLabel->priority = $this->config->gitlab->bugLabel->priority; - - $storyLabel = new stdclass(); - $storyLabel->name = $this->config->gitlab->storyLabel->name; - $storyLabel->description = $this->config->gitlab->storyLabel->description; - $storyLabel->color = $this->config->gitlab->storyLabel->color; - $storyLabel->priority = $this->config->gitlab->storyLabel->priority; - - $this->apiCreateLabel($gitlabID, $projectID, $taskLabel); - $this->apiCreateLabel($gitlabID, $projectID, $bugLabel); - $this->apiCreateLabel($gitlabID, $projectID, $storyLabel); - - return; - } - /** * Sync task to gitlab issue. * diff --git a/module/pipeline/model.php b/module/pipeline/model.php index 67f562cdc6..0fb35d711d 100644 --- a/module/pipeline/model.php +++ b/module/pipeline/model.php @@ -88,8 +88,6 @@ class pipelineModel extends model ->exec(); if(dao::isError()) return false; - $this->loadModel("gitlab")->initLabels($this->post->gitlabID, $this->post->projectID); - return $this->dao->lastInsertId(); } @@ -119,8 +117,6 @@ class pipelineModel extends model ->where('id')->eq($id) ->exec(); - if(!dao::isError()) $this->loadModel("gitlab")->initLabels($this->post->gitlabID, $this->post->projectID); - return !dao::isError(); } }