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.
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>
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.
@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! :)
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
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