Last modified: 2014-03-02 15:03:39 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 T31115, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29115 - add redirect target value on page info (ApiQueryInfo)
add redirect target value on page info (ApiQueryInfo)
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Low enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 50981 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-23 13:25 UTC by merl
Modified: 2014-03-02 15:03 UTC (History)
7 users (show)

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


Attachments

Description merl 2011-05-23 13:25:58 UTC
It would be nice to get the redirect target as info from api when querying a redirect page.

At the current wmf live version you have to parse the page content for getting the correct redirect target. That should be unnecessary in future because of bug 28952.
But you still have to make two api requests (without and with redirect-Parameter) if you are also interested in informations about the redirect page. (E.g. if it's a staticredirect using page=pageprops). 

It would be much easier if the redirect target information is also included in the page information when querying a page that is a redirect.

My suggestion would be that prop=info should contain this information in its redirect value. At the moment redirect="" is returned. This could be changed to redirect="iw:targetpage#anker", a combination of interwiki, fulltitle and fragment (splitting is not needed).

This shouldn't break existing tools because at the moment only the existence of this redirect attribute is tested and the value is ignored.
Comment 1 Roan Kattouw 2011-05-23 15:24:01 UTC
Because of the extra query (and possibly parsing the redirect if there is no entry in the table) required, this should be an optional inprop that's disabled by default.
Comment 2 merl 2011-05-23 15:32:16 UTC
Extra option is ok, but this extra query must only be executed if $this->pageIsRedir is true.
Comment 3 Umherirrender 2012-11-24 18:57:44 UTC
Commited Gerrit change #34977
Comment 4 Umherirrender 2012-12-10 19:43:09 UTC
successfully merged
Comment 5 Sam Reed (reedy) 2012-12-12 21:54:07 UTC
Reverted in https://gerrit.wikimedia.org/r/#/c/38434/

Causing a lot of API OOMs on commonswiki
Comment 6 Umherirrender 2012-12-13 16:58:54 UTC
No idea, why this change causes OOM

Have you more information?
Which query was used
* the new prop=info&inprop=redirecttargets
* or existing &redirects of action=query
because both sharing code here.
Comment 7 Sam Reed (reedy) 2012-12-13 18:35:14 UTC
(In reply to comment #6)
> No idea, why this change causes OOM
> 
> Have you more information?
> Which query was used
> * the new prop=info&inprop=redirecttargets
> * or existing &redirects of action=query
> because both sharing code here.

We don't have a url...

<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP Stack trace:
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   1. {main}() /usr/local/apache/common-local/live-1.5/api.php:0
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   2. require() /usr/local/apache/common-local/live-1.5/api.php:3
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   3. ApiMain->execute() /usr/local/apache/common-local/php-1.21wmf6/api.php:77
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   4. ApiMain->executeActionWithErrorHandling() /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiMain.php:349
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   5. ApiMain->executeAction() /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiMain.php:372
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   6. ApiQuery->execute() /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiMain.php:825
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   7. ApiPageSet->execute() /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiQuery.php:312
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   8. ApiPageSet->initFromTitles($titles = array (0 => 'File:Canadian Land Forces Command Badge.svg')) /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiPageSet.php:303
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP   9. ApiPageSet->resolvePendingRedirects() /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiPageSet.php:432
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP  10. ApiPageSet->getRedirectTargets() /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiPageSet.php:597
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP  11. ApiPageSet->resolveIdsToRedirectTargets($redirectIDs = array (0 => 16128102), $profileDB = 'profileDB') /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiPageSet.php:627
<binasher> Dec 12 21:44:38 10.0.2.218 apache2[9189]: PHP  12. Title::makeTitle($ns = '6', $title = 'Canadian_Army_Badge.svg', $fragment = '', $interwiki = '') /usr/local/apache/common-local/php-1.21wmf6/includes/api/ApiPageSet.php:682











In most cases, it was OOMing in the Title::makeTitle() call
Comment 8 Umherirrender 2012-12-13 19:50:17 UTC
Thanks. Must be something like

https://commons.wikimedia.org/w/api.php?action=query&titles=File:Canadian%20Land%20Forces%20Command%20Badge.svg&redirects=

maybe with prop-modules or more titles. I have still no idea.
Comment 9 Kelson [Emmanuel Engelhart] 2013-07-11 18:09:05 UTC
*** Bug 50981 has been marked as a duplicate of this bug. ***
Comment 10 Kelson [Emmanuel Engelhart] 2013-07-11 18:30:07 UTC
Would be great to be somehow able to reproduce the bug and get more details. Do we have a test/dev instance working against the commons DB?
Comment 11 Umherirrender 2014-03-02 15:03:39 UTC
Now a prop=redirects module exists (goes live with 1.23wmf16), which maybe can help here, because it shows all redirects to a page:

https://www.mediawiki.org/w/api.php?action=query&titles=MediaWiki&prop=redirects&rdlimit=100


You can also use it as a generator to get information about the redirects:

https://www.mediawiki.org/w/api.php?action=query&titles=MediaWiki&generator=redirects&grdlimit=100&prop=pageprops


It is also possible to use it with &redirects=

https://www.mediawiki.org/w/api.php?action=query&titles=Main%20Page&prop=redirects&rdlimit=100&redirects=


Using it with generator and redirects= looks not very helpful:

https://www.mediawiki.org/w/api.php?action=query&titles=Main%20Page&generator=redirects&grdlimit=100&redirects=&prop=pageprops

because the redirects also resolved for the titles of the generator and not only of the query action. Not sure, if that is a feature or not.

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


Navigation
Links