Page MenuHomePhabricator

Some MediaWiki API call examples show an empty result set due to hardcoded "Main Page" title
Closed, ResolvedPublic

Description

MediaWiki has gone and moved their "Main Page" to "MediaWiki". As a result of this, numerous API examples no longer work as originally intended. For example, clicking on the examples listed in the auto-documentation at https://www.mediawiki.org/wiki/API:Images , you will get an essentially empty result set, showing nothing of what the examples were intended to show.

Event Timeline

Anomie moved this task from Unsorted to Needs Code on the MediaWiki-Action-API board.
Anomie subscribed.

Someone could theoretically use Title::getMainPage(), but I'm not sure the extra complexity would really be worth it. Note that most of the time you'd also be needing to pass the main page title into the corresponding i18n message.

I hadn't actually thought to check that, Reedy. Oops! That's odd, though. I could swear most of the examples used to work. Did they maybe point to en-wiki or something? Or am I just remembering the old manual documentation? <shrug>

Aklapper renamed this task from API examples need updating to Some MediaWiki API call examples show an empty result set due to chosen query parameters.Oct 11 2019, 4:15 PM

You may have looked at them on enwiki or some other wiki where the main page is "Main Page". The old auto-generated documentation used the same examples as the current documentation does in almost all cases.

I just checked, and I'm thinking of the old manually documented examples (Template:ApiEx). They all pointed at enwiki. I finished the API portion of my project quite some time ago, so I haven't had much call to look at the live docs since then.

@srodlund this is a problem for the automatically generated documentation.

I don't know if there's a way to fix that in the documentation. I'm also not sure that @Anomie 's suggestion would actually help with that documentation.

I see ~41 references to "Main Page" in the API self-documentation. This is a pretty good first bug to fix.

@srishakatux @Aklapper Let's take a look at this together. Might be a good GCI task?

Might be a good GCI task?

@srodlund: Could you explain what exactly is supposed from a contributor in this task? Somehow finding and editing about 41 wiki pages on mediawiki.org (by probably replacing something with something else)? Or something else? If I was a complete newcomer, what would I have to do?

@eprodromou: I've read this task several times now and it's still unclear to me what exactly I'd have to do where as a new contributor, so I'm removing good first task. Feel free to add this tag again if all criteria on https://phabricator.wikimedia.org/tag/good_first_bug/ is fulfilled and in the task desc - thanks! :)

Ammarpad subscribed.

I don't think this can be fixed on MediaWiki.org alone since it's automatically generated from the doc, so it needs to be fixed from the doc source which can be achieved by removing the hardcorded "Main Page" from the url and (probably) elsewhere in the i18n messages. For instance on apart from Mediawiki.org, on Wikidata, "Main Page" is a redlink

Someone could theoretically use Title::getMainPage(), but I'm not sure the extra complexity would really be worth it.

Please what else can be done to achieve the same result?

Note that most of the time you'd also be needing to pass the main page title into the corresponding i18n message.

Maybe that should not hardcode the value too

Ammarpad renamed this task from Some MediaWiki API call examples show an empty result set due to chosen query parameters to Some MediaWiki API call examples show an empty result set due to hardcorded "Main Page" title.Nov 27 2019, 9:57 AM
Ammarpad renamed this task from Some MediaWiki API call examples show an empty result set due to hardcorded "Main Page" title to Some MediaWiki API call examples show an empty result set due to hardcoded "Main Page" title.Nov 27 2019, 10:00 AM

Change 553795 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Get correct mainpage in API call examples

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

Change 553795 abandoned by Ammarpad:
[mediawiki/core@master] Get correct main page in API call examples

Reason:
old patch

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

Krinkle subscribed.

@srodlund this is a problem for the automatically generated documentation. […]

I see ~41 references to "Main Page" in the API self-documentation. This is a pretty good first bug to fix.

Still an issue. I don't know whether PET still consider themselves steward over the MW API or not, but if they do then this is more an internal task that may have a patch to start with, then an external code review. As such, suggesting to keep this task on-track until it is resolved, rather than until the next time someone leaves a reply on Gerrit.

Change 553795 restored by Atieno:

[mediawiki/core@master] Get correct main page in API call examples

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

Change 553795 merged by jenkins-bot:

[mediawiki/core@master] Get correct main page in API call examples

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

Change 959020 had a related patch set uploaded (by Reedy; author: Ammarpad):

[mediawiki/core@REL1_40] Get correct main page in API call examples

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

Change 959289 had a related patch set uploaded (by Reedy; author: Ammarpad):

[mediawiki/core@REL1_39] Get correct main page in API call examples

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

Change 959020 merged by jenkins-bot:

[mediawiki/core@REL1_40] Get correct main page in API call examples

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

Change 959289 merged by jenkins-bot:

[mediawiki/core@REL1_39] Get correct main page in API call examples

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

Change merged and released. Closing this ticket