* Revert gitlab model.
This commit is contained in:
@@ -579,7 +579,7 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function apiGetProjects($gitlabID, $keyword = '', $orderBy, $pager)
|
||||
public function apiGetProjectsPager($gitlabID, $keyword = '', $orderBy, $pager)
|
||||
{
|
||||
$gitlab = $this->getByID($gitlabID);
|
||||
if(!$gitlab) return array();
|
||||
@@ -600,6 +600,32 @@ class gitlabModel extends model
|
||||
return array('pager' => $pager, 'projects' => json_decode($result['body']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projects of one gitlab.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function apiGetProjects($gitlabID)
|
||||
{
|
||||
$gitlab = $this->getByID($gitlabID);
|
||||
if(!$gitlab) return array();
|
||||
|
||||
$host = rtrim($gitlab->url, '/');
|
||||
$host .= '/api/v4/projects';
|
||||
|
||||
$allResults = array();
|
||||
for($page = 1; true; $page++)
|
||||
{
|
||||
$results = json_decode(commonModel::http($host . "?private_token={$gitlab->token}&simple=true&page={$page}&per_page=100"));
|
||||
if(!empty($results)) $allResults = array_merge($allResults, $results);
|
||||
if(count($results)<100 or $page > 10) break;
|
||||
}
|
||||
|
||||
return $allResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a gitab project by api.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user