now that the bug in the php github api is resolved we can remove this workaround
This commit is contained in:
parent
c7da6e28ca
commit
a5f886d97d
2 changed files with 2 additions and 44 deletions
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace helpers;
|
||||
|
||||
use Github\HttpClient\CachedHttpClient;
|
||||
use Guzzle\Http\Message\Response;
|
||||
|
||||
/**
|
||||
* This is to workaround this issue: https://github.com/KnpLabs/php-github-api/issues/133
|
||||
* "Pagination doesn't work correctly when CachedHttpClient is used"
|
||||
*/
|
||||
class CachedGithubClient extends CachedHttpClient
|
||||
{
|
||||
/**
|
||||
* @var Response
|
||||
*/
|
||||
private $actualLastResponse;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function request($path, $body = null, $httpMethod = 'GET', array $headers = array(), array $options = array())
|
||||
{
|
||||
$this->actualLastResponse = parent::request($path, $body, $httpMethod, $headers, $options);
|
||||
|
||||
return $this->actualLastResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*/
|
||||
public function getLastResponse()
|
||||
{
|
||||
return $this->actualLastResponse;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
namespace helpers;
|
||||
|
||||
use Github\Client;
|
||||
use Github\HttpClient\CachedHttpClient;
|
||||
use Github\ResultPager;
|
||||
|
||||
class GithubImporter {
|
||||
|
@ -37,7 +38,7 @@ class GithubImporter {
|
|||
|
||||
public static function buildClient($clientId, $clientSecret)
|
||||
{
|
||||
$httpClient = new CachedGithubClient(array('cache_dir' => realpath('../tmp/github_api_cache')));
|
||||
$httpClient = new CachedHttpClient(array('cache_dir' => realpath('../tmp/github_api_cache')));
|
||||
$client = new Client($httpClient);
|
||||
|
||||
if (!empty($clientId) && !empty($clientSecret)) {
|
||||
|
|
Reference in a new issue