Page MenuHomePhabricator

API returning empty results for list=usercontribs
Closed, ResolvedPublic

Description

Author: matthew.britton

Description:
The API is returning empty results for list=usercontribs on Wikimedia sites. Example: http://en.wikipedia.org/w/api.php?action=query&list=usercontribs&ucuser=Gurch


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/w/api.php?action=query&list=usercontribs&ucuser=Gurch

Details

Reference
bz21817

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:51 PM
bzimport set Reference to bz21817.

matthew.britton wrote:

Tested locally with wmf-deployment branch, works fine.

Server admin log for December 11 has:

  1. 01:26 logmsgbot: midom synchronized php-1.5/includes/api/ApiQueryUserContributions.php
  2. 00:37 Tim: killed long-running (34ks) API contributions query on db12, apparently filled up /a/tmp

which would be about when the problem started. Either the change is buggy or disabling the query was the intention, if the latter can it at least give an error message rather than blank output, it's breaking various tools.

Proposed fix: Add check for empty 'ucuser=' parameter to ApiQueryUserContributions.php

I suspect this may be the reason why it has been disabled:

api.php?action=query&list=ucercontribs&user=

results in

SELECT /* ApiQueryContributions::execute 127.0.0.1 */ rev_timestamp,page_namespace,page_title,rev_user_text,rev_deleted,rev_page,rev_id,page_latest,rev_comment,rev_len,rev_minor_edit,rev_parent_id FROM page,revision FORCE INDEX (usertext_timestamp) WHERE (page_id=rev_page) AND ((rev_deleted & 4) = 0) ORDER BY rev_timestamp DESC LIMIT 11

which will filesort the entire revision table due to the missing 'rev_user_text'-condition.

Attached:

(In reply to comment #2)

Created an attachment (id=6871) [details]
Proposed fix: Add check for empty 'ucuser=' parameter to
ApiQueryUserContributions.php

Domas applied this patch as a live hack, and I committed it to trunk in r59953.