From bcc98ae3e7dce9c1c967622d2fccebbb0f07e9fe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 12 Jun 2013 17:35:39 +0200 Subject: [ticket/11603] Rename network to forks and fix handling PHPBB3-11603 --- git-tools/setup_github_network.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'git-tools') diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php index 87ce2616e3..95f8c86ba3 100755 --- a/git-tools/setup_github_network.php +++ b/git-tools/setup_github_network.php @@ -22,7 +22,7 @@ function show_usage() echo " collaborators Repositories of people who have push access to the specified repository\n"; echo " contributors Repositories of people who have contributed to the specified repository\n"; echo " organisation Repositories of members of the organisation at github\n"; - echo " network All repositories of the whole github network\n"; + echo " forks All repositories of the whole github network\n"; echo "\n"; echo "Options:\n"; @@ -55,10 +55,10 @@ exit(work($scope, $username, $repository, $developer)); function work($scope, $username, $repository, $developer) { // Get some basic data - $network = get_network($username, $repository); + $forks = get_forks($username, $repository); $collaborators = get_collaborators($username, $repository); - if ($network === false || $collaborators === false) + if ($forks === false || $collaborators === false) { echo "Error: failed to retrieve network or collaborators\n"; return 1; @@ -67,19 +67,19 @@ function work($scope, $username, $repository, $developer) switch ($scope) { case 'collaborators': - $remotes = array_intersect_key($network, $collaborators); + $remotes = array_intersect_key($forks, $collaborators); break; case 'organisation': - $remotes = array_intersect_key($network, get_organisation_members($username)); + $remotes = array_intersect_key($forks, get_organisation_members($username)); break; case 'contributors': - $remotes = array_intersect_key($network, get_contributors($username, $repository)); + $remotes = array_intersect_key($forks, get_contributors($username, $repository)); break; - case 'network': - $remotes = $network; + case 'forks': + $remotes = $forks; break; default: @@ -210,20 +210,20 @@ function get_collaborators($username, $repository) return $usernames; } -function get_network($username, $repository) +function get_forks($username, $repository) { - $request = api_request("repos/show/$username/$repository/network"); + $request = api_request("repos/$username/$repository/forks"); if ($request === false) { return false; } $usernames = array(); - foreach ($request->network as $network) + foreach ($request as $fork) { - $usernames[$network->owner] = array( - 'username' => $network->owner, - 'repository' => $network->name, + $usernames[$fork->owner->login] = array( + 'username' => $fork->owner->login, + 'repository' => $fork->name, ); } -- cgit v1.2.1