Page MenuHomePhabricator

Getting detailed double-redirect information via the API
Open, Needs TriagePublic

Description

I've noticed that the FTB Wiki (a 3rd party Wiki) is capable of returning detailed double redirect information via the API (in the databaseResult object). WMF Wikis don't seem to be capable of doing this (example). Is this a special extension or is it a feature WMF wikis haven't been enabled? If so, why don't we have this? I think it'd be an incredibly useful feature!

Event Timeline

Fastily created this task.Jul 22 2018, 6:24 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 22 2018, 6:24 PM
Anomie closed this task as Invalid.Jul 23 2018, 12:56 PM
Anomie added a subscriber: Anomie.

Your testwiki link works for me

Fastily added a comment.EditedJul 23 2018, 7:24 PM

Sorry, but I'm not sure what you mean by that.

The testwiki query (/w/api.php?action=query&format=json&list=querypage&qppage=DoubleRedirects&qplimit=3) returns:

{
    "batchcomplete": "",
    "continue": {
        "qpoffset": 3,
        "continue": "-||"
    },
    "query": {
        "querypage": {
            "name": "DoubleRedirects",
            "cached": "",
            "cachedtimestamp": "2018-07-22T15:24:51Z",
            "maxresults": 5000,
            "results": [
                {
                    "value": "0",
                    "ns": 0,
                    "title": "Double2"
                },
                {
                    "value": "0",
                    "ns": 0,
                    "title": "Double"
                },
                {
                    "value": "0",
                    "ns": 0,
                    "title": "Lorem 2"
                }
            ]
        }
    }
}

The same query (/api.php?action=query&format=json&list=querypage&qppage=DoubleRedirects&qplimit=3) on the FTB wiki returns:

{
    "batchcomplete": "",
    "query": {
        "querypage": {
            "name": "DoubleRedirects",
            "results": [
                {
                    "value": "Getting_Started_(IndustrialCraft)/fr",
                    "ns": 0,
                    "title": "Getting Started (IndustrialCraft)/fr",
                    "databaseResult": {
                        "nsb": "0",
                        "tb": "IndustrialCraft_2/Guide/fr",
                        "nsc": "0",
                        "tc": "Getting_Started_(IndustrialCraft_2)/fr",
                        "iwc": ""
                    }
                }
            ]
        }
    }
}

Note that the testwiki results do not contain an additional databaseResult object. I was hoping this feature/extension could be turned on for WMF wikis.

Anomie reopened this task as Open.Jul 23 2018, 8:03 PM
Anomie moved this task from Unsorted to Needs details or plan on the MediaWiki-API board.

Ah, I see. That output is only generated if the caching for the special page is turned off, which of course we can't do on Wikimedia sites for performance reasons.

Offhand I can think of two ways to make MediaWiki be able to give this information when $wgMiserMode is on: either have SpecialDoubleRedirects somehow or other return it even when loading from querycache, or make an API module specifically for returning double redirect information that would do more or less the same thing.