Page MenuHomePhabricator

File redirects are not showing up in API backlinks queries
Closed, ResolvedPublic

Description

Author: carnildo

Description:
Visit http://en.wikipedia.org/w/api.php?action=query&blfilterredir=redirects&bltitle=File:Elisa_-_Stay_single_cover.jpg&list=backlinks&blredirect=1

Expected result: The redirect from [[File:Elisacoversta.jpg]] to [[File:Elisa - Stay single cover.jpg]] will be listed.

Actual result: An empty list of backlinks.


Version: unspecified
Severity: enhancement

Details

Reference
bz27621

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:28 PM
bzimport set Reference to bz27621.
bzimport added a subscriber: Unknown Object (MLST).

The imagelinks over redirects are not stored also by the target page, like templateredirects.

See also bug 23542

http://192.168.0.190/wiki/Special:WhatLinksHere/File:Blah.png

View (previous 50 | next 50) (20 | 50 | 100 | 250 | 500)
Main Page (← links)
File:Bah.png (redirect page; image link) (← links)
Main Page (← links)

It's there in the GUI...

http://192.168.0.190/wiki/Special:WhatLinksHere/File:Blah.png

View (previous 50 | next 50) (20 | 50 | 100 | 250 | 500)
Main Page (← links)
File:Bah.png (redirect page; image link) (← links)
Main Page (← links)

It's there in the GUI...

carnildo wrote:

(In reply to comment #4)

Fixed in r54567.

Please update and add explained comment.

That has absolutely nothing to do with this bug.

[[File:Elisacoversta.jpg]] doesn't *link* to [[File:Elisa - Stay single cover.jpg]] because the "link" in the redirect syntax is a file usage, not a link. And since backlinks only looks at links (specifically, the pagelinks table in the database), it won't find this. OTOH, https://en.wikipedia.org/w/api.php?action=query&iufilterredir=redirects&iutitle=File:Elisa_-_Stay_single_cover.jpg&list=imageusage&iuredirect=1 which looks at the imagelinks table does find it.

Special:WhatLinksHere uses the 'redirect' table to find redirects, and also checks imagelinks and templatelinks to generate its output.

Gerrit change 104764, which adds the ability to query the redirect table directly, will be a better way to find redirects if it gets merged.

Change 105829 had a related patch set uploaded by Anomie:
Move redirect rendering into WikitextContent

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

Change 105829 merged by jenkins-bot:
Move redirect rendering into WikitextContent

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

Should be deployed to WMF wikis with 1.23wmf10, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.

This will, of course, depend on those pages linking to the redirect having a LinksUpdate job run (e.g. they need to be edited, or purged with forcelinkupdate, or the file redirect could be purged with forcerecursivelinkupdate). That will also stop the redirect itself from showing up in list=imageusage.