* Modify server delete tip.

This commit is contained in:
caoyanyi
2022-08-05 15:39:24 +08:00
parent 53919cc470
commit 0679729a7e
18 changed files with 39 additions and 11 deletions
+19 -1
View File
@@ -131,10 +131,28 @@ class pipelineModel extends model
* @param string $id the id to be deleted
* @param string $object the action object
* @access public
* @return int
* @return int|bool
*/
public function delete($id, $object = 'gitlab')
{
if(in_array($object, array('gitlab', 'gitea', 'gogs')))
{
$repo = $this->dao->select('*')->from(TABLE_REPO)
->where('deleted')->eq('0')
->andWhere('SCM')->eq(ucfirst($object))
->andWhere('serviceHost')->eq($id)
->fetch();
if($repo) return false;
}
elseif($object == 'sonarqube')
{
$job = $this->dao->select('id,name,repo,deleted')->from(TABLE_JOB)
->where('frame')->eq('sonarqube')
->andWhere('server')->eq($id)
->andWhere('deleted')->eq('0')
->fetch();
if($job) return false;
}
$this->dao->update(TABLE_PIPELINE)->set('deleted')->eq(1)->where('id')->eq($id)->exec();
$this->loadModel('action')->create($object, $id, 'deleted', '', ACTIONMODEL::CAN_UNDELETED);