Page MenuHomePhabricator

ApiZeroPortal spams logs with warnings if there are sufficient Zero configurations
Closed, InvalidPublic

Description

ApiZeroPortal makes an internal API query (eew) to prop=revisions, passing it rvprop=content|timestamp and rvlimit=max. Since content is being requested, this makes the module apply lower limits to the query (50 without apihighlimits, 500 with apihighlimits).

It uses generator=allpages&gaplimit=max, which is going to feed the revisions module 500 (without apihighlimits) or 5000 (with apihighlimits) pages at a time.

This means that up to 450 or 4500 of the pages in the result will lack revisions output, since the lowered limit of the revisions module is exceeded. But ApiZeroPortal blindly assumes that every page in the result will have a revisions node, leading to PHP warnings for "Undefined index: revisions" and "Invalid argument supplied for foreach()" for every page node that didn't get a revisions node.

Possible fixes (besides not making internal API queries, which would probably be for the best but I doubt you'll go for):

  • Check whether isset( $page['revisions'] ) before trying to iterate over it.
  • Use gaplimit=50 and rvlimit=50, instead of max. You could detect if the user being used has apihighlimits and increase them both to 500 if you want.

Details

Related Gerrit Patches:
mediawiki/extensions/ZeroPortal : masterHandle missing revisions field in api response

Event Timeline

Anomie created this task.Jun 6 2016, 7:54 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 6 2016, 7:54 PM

Change 292991 had a related patch set uploaded (by Yurik):
Handle missing revisions field in api response

https://gerrit.wikimedia.org/r/292991

Change 292991 merged by jenkins-bot:
Handle missing revisions field in api response

https://gerrit.wikimedia.org/r/292991

Jdforrester-WMF closed this task as Invalid.Jul 11 2019, 6:25 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

The ZeroPortal extension has been undeployed and archived.