Page MenuHomePhabricator

Add a magic word to expose wiki ID
Open, Needs TriagePublic

Description

There a many magic words out there, but none that identify the wiki with its wiki ID (wfWikiId()). What I would like to see is a magic word that does this.

For example on en.wikipedia.org I would use {{WIKIID}} and it would output enwiki. On de.wikipedia.org it would output dewiki. On species.wikimedia.org it would out specieswiki, and so forth.

Event Timeline

Legoktm renamed this task from Add a magic word to identify the wiki with its name to Add a magic word to expose wiki ID.Dec 28 2017, 1:35 AM
Legoktm updated the task description. (Show Details)

What would this show for www.mydomain.xyz/wiki?

Whatever the output of wfWikiID() is.

I'm sure there's a reason for this request, but what is that reason?

I'm sure there's a reason for this request, but what is that reason?

IABot makes use of these identifiers to identify which wiki to access. Making use of the magic words will allow me to make the tools easier to access via my global userpage since it can take the user straight to their wiki. I've already tried making use of referrers, but that doesn't always work so there's my reason. I figured this particular magic word shouldn't be too difficult to add and shouldn't be expensive to use.

I'm sure there's a reason for this request, but what is that reason?

IABot makes use of these identifiers to identify which wiki to access. Making use of the magic words will allow me to make the tools easier to access via my global userpage since it can take the user straight to their wiki. I've already tried making use of referrers, but that doesn't always work so there's my reason. I figured this particular magic word shouldn't be too difficult to add and shouldn't be expensive to use.

Does global user page actually change the invocation of magic words when on a separate wiki, today? E.g. does {{FULLPAGENAME}} change from User:CBP to Usario:CBP?

I believe it does. I believe the global user page is transmitted as wiki text to the local page, and then rendered locally. If I place a working template on my meta template, that doesn't exist on a different wiki, it will redlink there.

You can already use {{SERVERNAME}}, "en.wikipedia.org" is probably more useful than "enwiki" for most cases anyway. https://www.mediawiki.org/wiki/Help:Magic_words#Technical_metadata

This will not work for your global user page use case, though. Global user pages are rendered on the "central" wiki, not local wikis. (They are "transmitted" as the rendered HTML, not wikitext.) https://www.mediawiki.org/wiki/Help:Extension:GlobalUserPage#Where_content_comes_from

You can already use {{SERVERNAME}}, "en.wikipedia.org" is probably more useful than "enwiki" for most cases anyway. https://www.mediawiki.org/wiki/Help:Magic_words#Technical_metadata

This will not work for your global user page use case, though. Global user pages are rendered on the "central" wiki, not local wikis. (They are "transmitted" as the rendered HTML, not wikitext.) https://www.mediawiki.org/wiki/Help:Extension:GlobalUserPage#Where_content_comes_from

Sorry, but that won't do. That's not how IABot is structured.