* [task#137685,doing,0.4h] adjust repo tags api params.
This commit is contained in:
@@ -130,26 +130,31 @@ class gitlabRepo
|
||||
* Get tags
|
||||
*
|
||||
* @param string $showDetail
|
||||
* @param string $revision
|
||||
* @param bool $onlyDir
|
||||
* @param int $limit
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function tags($showDetail = '')
|
||||
public function tags($showDetail = '', $revision = 'HEAD', $onlyDir = true, int $limit = 0, int $pageID = 1)
|
||||
{
|
||||
$api = "tags";
|
||||
$tags = array();
|
||||
|
||||
$params = array();
|
||||
$params['per_page'] = '100';
|
||||
$params['per_page'] = $limit ? $limit : '100';
|
||||
$params['order_by'] = 'updated';
|
||||
$params['sort'] = 'asc';
|
||||
for($page = 1; true; $page ++)
|
||||
if($showDetail && $showDetail != 'all') $params['search'] = $showDetail;
|
||||
for($page = $pageID; true; $page ++)
|
||||
{
|
||||
$params['page'] = $page;
|
||||
$list = $this->fetch($api, $params);
|
||||
if(empty($list) || !is_array($list)) break;
|
||||
|
||||
foreach($list as $tag) $tags[] = $showDetail ? $tag : $tag->name;
|
||||
if(count($list) < $params['per_page']) break;
|
||||
if($limit || count($list) < $params['per_page']) break;
|
||||
}
|
||||
|
||||
return $tags;
|
||||
@@ -169,6 +174,7 @@ class gitlabRepo
|
||||
/* Max size of per_page in gitlab API is 100. */
|
||||
$params = array();
|
||||
$params['per_page'] = $limit ? $limit : '100';
|
||||
if($showDetail && $showDetail != 'all') $params['search'] = $showDetail;
|
||||
|
||||
$branches = array();
|
||||
$default = array();
|
||||
|
||||
@@ -39,13 +39,15 @@ class scm
|
||||
* @param string $path svn use path, git service filter return data.
|
||||
* @param string $revision
|
||||
* @param bool $onlyDir
|
||||
* @param int $limit
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function tags($path = '', $revision = 'HEAD', $onlyDir = true)
|
||||
public function tags($path = '', $revision = 'HEAD', $onlyDir = true, int $limit = 0, int $pageID = 1)
|
||||
{
|
||||
if(!scm::checkRevision($revision)) return array();
|
||||
return $this->engine->tags($path, $revision, $onlyDir);
|
||||
return $this->engine->tags($path, $revision, $onlyDir, $limit, $pageID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,12 +56,12 @@ class scm
|
||||
* @access public
|
||||
* @param string $showDetail
|
||||
* @param int $limit
|
||||
* @param int $prePage
|
||||
* @param int $pageID
|
||||
* @return array
|
||||
*/
|
||||
public function branch(string $showDetail = '', int $limit = 0, int $prePage = 1)
|
||||
public function branch(string $showDetail = '', int $limit = 0, int $pageID = 1)
|
||||
{
|
||||
return $this->engine->branch($showDetail, $limit, $prePage);
|
||||
return $this->engine->branch($showDetail, $limit, $pageID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user