* finish task #6939.
This commit is contained in:
+31
-31
@@ -11,6 +11,18 @@
|
||||
*/
|
||||
class compileModel extends model
|
||||
{
|
||||
/**
|
||||
* Get by id
|
||||
*
|
||||
* @param int $buildID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByID($buildID)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_COMPILE)->where('id')->eq($buildID)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get build list.
|
||||
*
|
||||
@@ -34,18 +46,6 @@ class compileModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id
|
||||
*
|
||||
* @param int $buildID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByID($buildID)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_COMPILE)->where('id')->eq($buildID)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unexecuted list.
|
||||
*
|
||||
@@ -57,6 +57,25 @@ class compileModel extends model
|
||||
return $this->dao->select('*')->from(TABLE_COMPILE)->where('status')->eq('')->andWhere('deleted')->eq('0')->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get build url.
|
||||
*
|
||||
* @param object $jenkins
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildUrl($jenkins)
|
||||
{
|
||||
$jenkinsServer = $jenkins->url;
|
||||
$jenkinsUser = $jenkins->account;
|
||||
$jenkinsPassword = $jenkins->token ? $jenkins->token : base64_decode($jenkins->password);
|
||||
|
||||
$jenkinsAuth = '://' . $jenkinsUser . ':' . $jenkinsPassword . '@';
|
||||
$jenkinsServer = str_replace('://', $jenkinsAuth, $jenkinsServer);
|
||||
$buildUrl = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->jkJob);
|
||||
return $buildUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save build by integration
|
||||
*
|
||||
@@ -112,23 +131,4 @@ class compileModel extends model
|
||||
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get build url.
|
||||
*
|
||||
* @param object $jenkins
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildUrl($jenkins)
|
||||
{
|
||||
$jenkinsServer = $jenkins->url;
|
||||
$jenkinsUser = $jenkins->account;
|
||||
$jenkinsPassword = $jenkins->token ? $jenkins->token : base64_decode($jenkins->password);
|
||||
|
||||
$jenkinsAuth = '://' . $jenkinsUser . ':' . $jenkinsPassword . '@';
|
||||
$jenkinsServer = str_replace('://', $jenkinsAuth, $jenkinsServer);
|
||||
$buildUrl = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->jkJob);
|
||||
return $buildUrl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user