GitlabDriver V4 Paging
V4 of gitlab api requires paging in tags/branchespull/6592/head
parent
b07be842a0
commit
be1f675992
|
@ -280,6 +280,7 @@ class GitLabDriver extends VcsDriver
|
||||||
{
|
{
|
||||||
$resource = $this->getApiUrl().'/repository/'.$type;
|
$resource = $this->getApiUrl().'/repository/'.$type;
|
||||||
|
|
||||||
|
do {
|
||||||
$data = JsonFile::parseJson($this->getContents($resource), $resource);
|
$data = JsonFile::parseJson($this->getContents($resource), $resource);
|
||||||
|
|
||||||
$references = array();
|
$references = array();
|
||||||
|
@ -291,6 +292,8 @@ class GitLabDriver extends VcsDriver
|
||||||
// unnecessary API call when retrieving the composer file.
|
// unnecessary API call when retrieving the composer file.
|
||||||
$this->commits[$datum['commit']['id']] = $datum['commit'];
|
$this->commits[$datum['commit']['id']] = $datum['commit'];
|
||||||
}
|
}
|
||||||
|
$resource = $this->getNextPage();
|
||||||
|
} while ($resource);
|
||||||
|
|
||||||
return $references;
|
return $references;
|
||||||
}
|
}
|
||||||
|
@ -444,6 +447,21 @@ class GitLabDriver extends VcsDriver
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getNextPage()
|
||||||
|
{
|
||||||
|
$headers = $this->remoteFilesystem->getLastHeaders();
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if (substr($header, 0, 5) === 'Link:') {
|
||||||
|
$links = explode(',', substr($header, 5));
|
||||||
|
foreach ($links as $link) {
|
||||||
|
if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
|
||||||
|
return $match[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $configuredDomains
|
* @param array $configuredDomains
|
||||||
* @param string $guessedDomain
|
* @param string $guessedDomain
|
||||||
|
|
Loading…
Reference in New Issue