Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383941 )

Change subject: Handle and debug case where API returns no pages
......................................................................

Handle and debug case where API returns no pages

Bug: T177988
Change-Id: I395ba99a120a494ba6362527464dd09ce07fa084
---
M includes/DataProvider.php
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection 
refs/changes/41/383941/1

diff --git a/includes/DataProvider.php b/includes/DataProvider.php
index 2d438b5..0e091f9 100644
--- a/includes/DataProvider.php
+++ b/includes/DataProvider.php
@@ -166,7 +166,13 @@
                        $data = $this->makeActionApiRequest( $params );
                        $continue = isset( $data['continue'] ) ? 
$data['continue'] : [];
                        $params = $continue + $params;
-                       foreach ( $data['query']['pages'] as $page ) {
+                       if ( isset( $data['query']['pages'] ) ) {
+                               $pages = $data['query']['pages'];
+                       } else {
+                               $pages = [];
+                               wfDebugLog( 'collection', 'No pages were found 
with query: ' . json_encode( $params ) );
+                       }
+                       foreach ( $pages as $page ) {
                                // Contributors will not be defined if pclimit 
is hit one of the other pages
                                if ( isset( $page['contributors'] ) ) {
                                        foreach ( $page['contributors'] as $key 
=> $contrib ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/383941
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I395ba99a120a494ba6362527464dd09ce07fa084
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to