Last modified: 2014-09-24 01:33:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T52981, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 50981 - API Listredirects results should contain target/to title
API Listredirects results should contain target/to title
Status: RESOLVED DUPLICATE of bug 29115
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.22.0
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-08 21:11 UTC by Kelson [Emmanuel Engelhart]
Modified: 2014-09-24 01:33 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kelson [Emmanuel Engelhart] 2013-07-08 21:11:33 UTC
It seems to be impossible to get, using the MW API, a similar result like
https://en.wikipedia.org/wiki/Special:ListRedirects

"list=querypage&qppage=Listredirects" returns only a list of "from" without giving the "to" (target) title. Same for "list=allpages&apfilterredir=redirects".

This is annoying because it seems to exist no solution to find quickly all redirects (from/to) in a MW instance.
Comment 1 Brad Jorsch 2013-07-09 14:32:15 UTC
ApiQueryQueryPage just uses the "namespace", "title", and "value" columns from the QueryPage, which are also all that is stored in the querycache table.

Special:Listredirects either (if not cached) loads extra columns or (if cached) does additional database queries in its formatResult() method, which the API module has no way of knowing about.

At the moment, your best bet is to use action=query&list=allpages&apfilterredir=redirects to get a list of redirects, and then make a second call to action=query&redirects=1&pageids=... (specifying all the pageids from the first query, no prop module need be specified) to get the targets.
Comment 2 Brad Jorsch 2013-07-09 14:32:27 UTC
To really fix this, it should be easy enough to add an option to ApiQueryInfo to return the information from the redirects table, very much along the lines of how it already handles inprop=displaytitle. Then we would also add Listredirects to the $uselessQueryPages list in ApiQueryQueryPage, since generator=allpages&gapfilterredir=redirects&prop=info&inprop=<something> would be entirely equivalent.
Comment 3 Kelson [Emmanuel Engelhart] 2013-07-09 15:51:11 UTC
Thank you Brad for your feedback. If this is not so complicated, I will have a look to the code and try to implement inprop=redirect. Hope to have it then reviewed...
Comment 4 Umherirrender 2013-07-11 15:37:55 UTC
adding the redirect target to prop=info is bug 29115
Comment 5 Kelson [Emmanuel Engelhart] 2013-07-11 18:09:05 UTC
Seems to me to be a duplicate. Thx Umherirrender.

*** This bug has been marked as a duplicate of bug 29115 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links