Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Compatibility with PHP 5.3.2+.

  • Loading branch information...
commit 912caa06c45b38bd5cb60547313c9ed0aba9d9aa 1 parent ec6ea9b
Vasil Rangelov boenrobot authored
Showing with 30 additions and 4 deletions.
  1. +30 −4 src/PEAR2Web/Models/Package.php
34 src/PEAR2Web/Models/Package.php
View
@@ -16,7 +16,7 @@ public function __construct($options = array())
parent::__construct($options);
$this->cache = new \PEAR2\Cache\Lite\Main();
$this->cache->setLifeTime(15 * 60);
-
+
$this->shortName = str_replace('PEAR2_', '', $this->name);
}
@@ -64,7 +64,20 @@ public function getGitHubIssueCount($state)
if ($json === false) {
$uri = self::GIT_HUB_API . $this->shortName . '/issues?state=' . $state;
- $json = file_get_contents($uri);
+ $json = file_get_contents(
+ $uri, false,
+ stream_context_create(
+ array(
+ 'http' => array(
+ 'ignore_errors' => true
+ )
+ )
+ )
+ );
+ if (false === strpos($http_response_header[0], ' 200 ')) {
+ $json = false;
+ }
+
if ($json === false) {
$json = $this->cache->get($key, 'default', false);
} else {
@@ -81,12 +94,25 @@ public function getGitHubIssueCount($state)
protected function getGithubInfo()
{
- $key = $this->name . "-wiki";
+ $key = $this->name . "-info";
$json = $this->cache->get($key);
if ($json === false) {
$uri = self::GIT_HUB_API . $this->shortName;
- $json = is_file($uri) && file_get_contents($uri);
+ $json = file_get_contents(
+ $uri, false,
+ stream_context_create(
+ array(
+ 'http' => array(
+ 'ignore_errors' => true
+ )
+ )
+ )
+ );
+ if (false === strpos($http_response_header[0], ' 200 ')) {
+ $json = false;
+ }
+
if ($json === false) {
$json = $this->cache->get($key, 'default', false);
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.