Page MenuHomePhabricator

[RFC] Filter gadgets server-side?
Closed, DuplicatePublic

Description

This is not really a task or a bug, but more of a question from a toy maker (gadget author) to MediaWiki developers. The question is, would is make sense to filter gadgets server-side? Many gadgets are only applicable on a certain page, or in a certain namespace, or during a certain action. However, they are currently loaded everywhere anyway.
To show you what I mean, here is an example of what MediaWiki:Gadgets-definition could look like:

WikidataSearchResults[default|ResourceLoader|page=Special:Search]|WikidataSearchResults.js
CommonsUploads[default|ResourceLoader|ns=2,3]|CommonsUploads.js
Edittools[default|ResourceLoader|action=edit,submit]|Edittools.js

(I know that work is being done on a visual gadgets-definition, making this exact syntax obsolete, but that's beside the point)
The crucial question, of course, is whether this would be a performace improvement.

Event Timeline

Nirmos created this task.Sep 18 2016, 11:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 18 2016, 11:14 PM

Well, your examples show one problem with such a filter: It's easy to forget situations where the gadget should be loaded. IIRC WikidataSearchResults works on missing pages, too, and Edittools on Special:Upload. Doing this properly would require an awful syntax.

One solution that's easily possible with the current syntax is to split the gadget into a loader and a core module, see "FormWizard" on https://en.wikipedia.org/wiki/Special:Gadgets for an example.

OTOH, under normal circumstances a gadget should almost always be loaded from browser cache, the parsing time should be negligible, so I don't really see a performance gain by filtered loading.

Restricted Application added a project: Performance-Team. · View Herald TranscriptMar 15 2018, 11:17 AM