aboutsummaryrefslogtreecommitdiffstats
path: root/git-tools
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-02-15 04:49:48 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-15 05:20:30 -0500
commit30c46a6e0ca76f99bede700d8e77b37dc1a62f99 (patch)
treece7342c0cf6832c9d3287b1410545061a937ea6f /git-tools
parent0f3378ca28308eec4cc61d8e5170c4f40ad41699 (diff)
downloadforums-30c46a6e0ca76f99bede700d8e77b37dc1a62f99.tar
forums-30c46a6e0ca76f99bede700d8e77b37dc1a62f99.tar.gz
forums-30c46a6e0ca76f99bede700d8e77b37dc1a62f99.tar.bz2
forums-30c46a6e0ca76f99bede700d8e77b37dc1a62f99.tar.xz
forums-30c46a6e0ca76f99bede700d8e77b37dc1a62f99.zip
[ticket/10044] Error handling for remote requests in setup_github_network.php
PHPBB3-10044
Diffstat (limited to 'git-tools')
-rwxr-xr-xgit-tools/setup_github_network.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php
index 80cc62df8a..ae3d34f5fe 100755
--- a/git-tools/setup_github_network.php
+++ b/git-tools/setup_github_network.php
@@ -134,12 +134,21 @@ function get_repository_url($username, $repository, $ssh = false)
function api_request($query)
{
- return json_decode(file_get_contents("http://github.com/api/v2/json/$query"));
+ $contents = file_get_contents("http://github.com/api/v2/json/$query");
+ if ($contents === false)
+ {
+ return false;
+ }
+ return json_decode($contents);
}
function get_contributors($username, $repository)
{
$request = api_request("repos/show/$username/$repository/contributors");
+ if ($request === false)
+ {
+ return false;
+ }
$usernames = array();
foreach ($request->contributors as $contributor)
@@ -153,6 +162,10 @@ function get_contributors($username, $repository)
function get_organisation_members($username)
{
$request = api_request("organizations/$username/public_members");
+ if ($request === false)
+ {
+ return false;
+ }
$usernames = array();
foreach ($request->users as $member)
@@ -166,6 +179,10 @@ function get_organisation_members($username)
function get_collaborators($username, $repository)
{
$request = api_request("repos/show/$username/$repository/collaborators");
+ if ($request === false)
+ {
+ return false;
+ }
$usernames = array();
foreach ($request->collaborators as $collaborator)
@@ -179,6 +196,10 @@ function get_collaborators($username, $repository)
function get_network($username, $repository)
{
$request = api_request("repos/show/$username/$repository/network");
+ if ($request === false)
+ {
+ return false;
+ }
$usernames = array();
foreach ($request->network as $network)