From 92c55ab111f5d28626975310fc93f35b3ca00ab0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 13 Jun 2013 18:41:23 +0200 Subject: [PATCH] [ticket/11603] Fix spacing and add some comments PHPBB3-11603 --- git-tools/setup_github_network.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php index de3ea55d13..3f1f61b288 100755 --- a/git-tools/setup_github_network.php +++ b/git-tools/setup_github_network.php @@ -156,17 +156,19 @@ function api_request($query, $full_url = false) } curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_USERAGENT, 'phpBB/1.0'); - curl_setopt($c, CURLOPT_HEADER, true); + curl_setopt($c, CURLOPT_HEADER, true); $contents = curl_exec($c); curl_close($c); $sub_request_result = array(); + // Split possible headers from the body if ($contents && strpos($contents, "\r\n\r\n") > 0) { list($header, $contents) = explode("\r\n\r\n", $contents); foreach (explode("\n", $header) as $header_element) { - if (strpos($header_element, 'Link') === 0) + // Find Link Header which gives us a link to the next page + if (strpos($header_element, 'Link: ') === 0) { list($head, $header_content) = explode(': ', $header_element); foreach (explode(', ', $header_content) as $links) @@ -174,6 +176,7 @@ function api_request($query, $full_url = false) list($url, $rel) = explode('; ', $links); if ($rel == 'rel="next"') { + // Found a next link, follow it and merge the results $sub_request_result = api_request(substr($url, 1, -1), true); } }