diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-06-13 18:43:04 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-06-13 18:43:04 +0200 |
commit | a7af0134c0cdd5577a094e78ddae258711591b10 (patch) | |
tree | 2c55449aacfe4ec011221eb925879f3f24fc7521 /git-tools | |
parent | [ticket/11603] Fix spacing and add some comments (diff) | |
download | phpbb-a7af0134c0cdd5577a094e78ddae258711591b10.tar.gz phpbb-a7af0134c0cdd5577a094e78ddae258711591b10.tar.bz2 phpbb-a7af0134c0cdd5577a094e78ddae258711591b10.zip |
[ticket/11603] Split api_request into two functions (query only vs. full url)
PHPBB3-11603
Diffstat (limited to 'git-tools')
-rwxr-xr-x | git-tools/setup_github_network.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php index 3f1f61b288..c24968c7c2 100755 --- a/git-tools/setup_github_network.php +++ b/git-tools/setup_github_network.php @@ -143,17 +143,15 @@ function get_repository_url($username, $repository, $ssh = false) return $url_base . $username . '/' . $repository . '.git'; } -function api_request($query, $full_url = false) +function api_request($query) +{ + return api_url_request("https://api.github.com/$query?per_page=100"); +} + +function api_url_request($url) { $c = curl_init(); - if ($full_url) - { - curl_setopt($c, CURLOPT_URL, $query); - } - else - { - curl_setopt($c, CURLOPT_URL, "https://api.github.com/$query?per_page=100"); - } + curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_USERAGENT, 'phpBB/1.0'); curl_setopt($c, CURLOPT_HEADER, true); @@ -177,7 +175,7 @@ function api_request($query, $full_url = false) if ($rel == 'rel="next"') { // Found a next link, follow it and merge the results - $sub_request_result = api_request(substr($url, 1, -1), true); + $sub_request_result = api_url_request(substr($url, 1, -1)); } } } |