Jdlrobson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/382880 )
Change subject: Avoid notices on large articles ...................................................................... Avoid notices on large articles Articles which have more than 500 contributors or 500 images (the maximum number allowed) will lead to this field not being set for other pages The limit is for contributors/images across all articles, not for each individual article Change-Id: I24728a0156490fadff8d39ce87d564584576a5cc --- M includes/DataProvider.php 1 file changed, 14 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection refs/changes/80/382880/1 diff --git a/includes/DataProvider.php b/includes/DataProvider.php index 7e5cd5c..d283763 100644 --- a/includes/DataProvider.php +++ b/includes/DataProvider.php @@ -63,6 +63,7 @@ if ( isset( $item['revision'] ) ) { $url .= '/' . $item['revision']; } + return [ 'method' => 'GET', 'url' => $url, @@ -153,6 +154,9 @@ 'action' => 'query', 'prop' => 'contributors|images', 'redirects' => 1, + // Note that the imlimit and pclimit applies to all titles so this will result in + // an incomplete list of contributors + 'imlimit' => 'max', 'pclimit' => 'max', // 500; more titles than that will probably blow up Electron anyway 'titles' => implode( '|', $dbkeys ), ]; @@ -162,11 +166,17 @@ $continue = isset( $data['continue'] ) ? $data['continue'] : []; $params = $continue + $params; foreach ( $data['query']['pages'] as $page ) { - foreach ( $page['contributors'] as $key => $contrib ) { - $metadata['contributors'][$contrib['name']] = $contrib['userid']; + // Contributors will not be defined if pclimit is hit one of the other pages + if ( isset( $page['contributors'] ) ) { + foreach ( $page['contributors'] as $key => $contrib ) { + $metadata['contributors'][$contrib['name']] = $contrib['userid']; + } } - foreach ( $page['images'] as $image ) { - $images[] = $image['title']; + // Imagess will not be defined if imlimit is hit one of the other pages + if ( isset( $page['images'] ) ) { + foreach ( $page['images'] as $image ) { + $images[] = $image['title']; + } } } } while ( $continue ); -- To view, visit https://gerrit.wikimedia.org/r/382880 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I24728a0156490fadff8d39ce87d564584576a5cc 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