mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/10044] Error handling for remote requests in setup_github_network.php
PHPBB3-10044
This commit is contained in:
parent
0f3378ca28
commit
30c46a6e0c
1 changed files with 22 additions and 1 deletions
|
@ -134,12 +134,21 @@ function get_repository_url($username, $repository, $ssh = false)
|
||||||
|
|
||||||
function api_request($query)
|
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)
|
function get_contributors($username, $repository)
|
||||||
{
|
{
|
||||||
$request = api_request("repos/show/$username/$repository/contributors");
|
$request = api_request("repos/show/$username/$repository/contributors");
|
||||||
|
if ($request === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$usernames = array();
|
$usernames = array();
|
||||||
foreach ($request->contributors as $contributor)
|
foreach ($request->contributors as $contributor)
|
||||||
|
@ -153,6 +162,10 @@ function get_contributors($username, $repository)
|
||||||
function get_organisation_members($username)
|
function get_organisation_members($username)
|
||||||
{
|
{
|
||||||
$request = api_request("organizations/$username/public_members");
|
$request = api_request("organizations/$username/public_members");
|
||||||
|
if ($request === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$usernames = array();
|
$usernames = array();
|
||||||
foreach ($request->users as $member)
|
foreach ($request->users as $member)
|
||||||
|
@ -166,6 +179,10 @@ function get_organisation_members($username)
|
||||||
function get_collaborators($username, $repository)
|
function get_collaborators($username, $repository)
|
||||||
{
|
{
|
||||||
$request = api_request("repos/show/$username/$repository/collaborators");
|
$request = api_request("repos/show/$username/$repository/collaborators");
|
||||||
|
if ($request === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$usernames = array();
|
$usernames = array();
|
||||||
foreach ($request->collaborators as $collaborator)
|
foreach ($request->collaborators as $collaborator)
|
||||||
|
@ -179,6 +196,10 @@ function get_collaborators($username, $repository)
|
||||||
function get_network($username, $repository)
|
function get_network($username, $repository)
|
||||||
{
|
{
|
||||||
$request = api_request("repos/show/$username/$repository/network");
|
$request = api_request("repos/show/$username/$repository/network");
|
||||||
|
if ($request === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$usernames = array();
|
$usernames = array();
|
||||||
foreach ($request->network as $network)
|
foreach ($request->network as $network)
|
||||||
|
|
Loading…
Add table
Reference in a new issue