* Adjust param of ciModel::checkCompileStatus function.

This commit is contained in:
Guan Xiying
2021-07-29 16:26:20 +08:00
parent f62cbc2792
commit 6fe756fb14
2 changed files with 12 additions and 17 deletions
+8 -8
View File
@@ -61,21 +61,21 @@ class ci extends control
/**
* Send a request to jenkins or gitlab to check build status.
*
* @param string $gitlabOnly
* @param int $compileID
* @access public
* @return string
* @return void
*/
public function checkCompileStatus($gitlabOnly = 'no')
public function checkCompileStatus($compileID = 0)
{
$this->ci->checkCompileStatus($gitlabOnly);
$this->ci->checkCompileStatus($compileID);
if(dao::isError())
{
echo json_encode(dao::getError());
return true;
}
else
{
echo $gitlabOnly == 'yes' ? 'gitlab success' : 'success';
}
echo 'success';
}
/**
+4 -9
View File
@@ -23,10 +23,11 @@ class ciModel extends model
/**
* Send a request to jenkins to check build status.
*
* @param int $compileID
* @access public
* @return void
*/
public function checkCompileStatus($gitlabOnly = 'no')
public function checkCompileStatus($compileID = 0)
{
$compiles = $this->dao->select('compile.*, job.engine,job.pipeline, pipeline.name as jenkinsName,job.server,pipeline.url,pipeline.account,pipeline.token,pipeline.password')
->from(TABLE_COMPILE)->alias('compile')
@@ -36,17 +37,11 @@ class ciModel extends model
->andWhere('compile.status')->ne('failure')
->andWhere('compile.status')->ne('create_fail')
->andWhere('compile.status')->ne('timeout')
->beginIf($compileID)->andWhere('compile.id')->eq($compileID)->fi()
->andWhere('compile.createdDate')->gt(date(DT_DATETIME1, strtotime("-1 day")))
->fetchAll();
if($gitlabOnly == 'yes')
{
foreach($compiles as $compile) if($compile->engine == 'gitlab') $this->syncCompileStatus($compile);
}
elseif($gitlabOnly == 'no')
{
foreach($compiles as $compile) $this->syncCompileStatus($compile);
}
foreach($compiles as $compile) $this->syncCompileStatus($compile);
}
/**