Topic on Template talk:Extension

Getting mediawiki from extension.json

10
André Costa (WMSE) (talkcontribs)

I tried to get the template to get the |mediawiki= parameter from extension.json. Since I didn't want to try it live I implemented it in Module:Extension/sandbox then tried to preview it here by replacing {{{mediawiki|}}} with {{#invoke:extension/sandbox|getMediawiki|{{{mediawiki|}}}}}. But it looks like the sandbox isn't loaded so not sure how to test this before going live.

Tacsipacsi (talkcontribs)

If you replace

</noinclude><includeonly>{{#switch:<translate></translate>

in the third line with

</noinclude><includeonly>{{#switch:

the result looks awful, but at least it depends on what in Template:Extension is rather than what in Template:Extension/en is. (Don’t forget to revert this change before saving!) However, I’m not sure if reading the MediaWiki requirement from extension.json would be appropriate—extension.json in master lists what master is compatible with, while (IMO) the infobox should list what MediaWiki version any of its versions is compatible with.

André Costa (WMSE) (talkcontribs)

Thanks! Tested and {{{mediawiki|{{#invoke:extension|getMediawiki}}} should do the trick once the issue below is resolved.

With regard to the infobox reflecting master. By already now fetching most of the parameters from the extension.json the template already only reflects master (unless manually overridden). I.e. if a user right is dropped/added between the latest release and master then the infobox will update to reflect that. I'd say it's only natural that the mediawiki parameter follows the same default.

Tacsipacsi (talkcontribs)

Naturally an infobox can’t list all versions of configuration variables, hooks, user rights etc., as that would occupy a lot of space. However, listing an earlier MediaWiki version doesn’t, so it’s feasible, and I think it’s worth it, as a potential user is more interested in whether any version of the extension is compatible with their MediaWiki than in whether master is compatible. (By the way, listing user rights is useful, but I’m not sure whether listing used hooks and variables—without any explanation—makes any sense in the infobox. What’s the practical use of these kinds of information?)

Pppery (talkcontribs)

Hah, I'm not the only one who was very annoyed by the difficulty of testing changes to translatable templates: You can work around the problem by replacing #invoke:Template translation with #invoke:Template translation/sandbox, which uses the code I wrote in Module:Template translation/sandbox. I should probably request that that code be merged to Module:Template translation, but never get around to it. Also, I agree with Tacsipacsi that this may not be an appropriate thing to automate (as I wrote on phab:T222479,

The "MediaWiki" key can't be supported because most WMF maintained extensions use backward-compatibility branches, and the module only contains data from the master branch.

)

Tacsipacsi (talkcontribs)

Wow, thanks! I tested Template:Hubs/sandbox just a few days ago, and was very satisfied that I haven’t broken anything—until I realized that the test cases in the documentation actually used the non-sandbox version… Now I added {{\sandbox}} to it. I’m glad we can always come up with new hacks to support Translate (like this one or {{#switch:<translate></translate> or c:Module:Caller title)—although I’m not particularly happy that we need to do so…

André Costa (WMSE) (talkcontribs)

Personally I don't see it as any different from overriding any other parameter. I.e. if the infobox today has a manually entered value then keep that, if not then get it from extension (because some info on version limitations is better than none).

I think the Hook listings are mainly used for categorising the extension page.

On a separate note there should probably be a small remark next to the version field that the info in the infobox need not reflect that version any more.

Tacsipacsi (talkcontribs)

I.e. if the infobox today has a manually entered value then keep that, if not then get it from extension (because some info on version limitations is better than none).

That’s fair, but we need to make sure that people won’t throw out existing parameters like what happens now with other extension.json-backed ones, as well as suggest filling out the version parameter in new/revised infoboxes (as opposed to hooks and the like).

Jdforrester (WMF) (talkcontribs)

I disagree; I think documenting the current reality is much more helpful for people.

Tacsipacsi (talkcontribs)

Whom do you disagree with? What do you mean by “reality”? Both the oldest supported version is a kind of reality (that is where you have a chance to install the extension), and the version supported by master is a kind of reality (that is where any eventual bugs have a real chance to be fixed).

Reply to "Getting mediawiki from extension.json"