Implements:
* Gadget definition content and content handler
* Basic validation for gadget definition content
* GadgetDefinitionNamespace implementation of GadgetRepo
* DataUpdates upon editing/deletion of Gadget definition pages
* EditFilterMerged hook for improved error messages
* 'GadgetsRepoClass' option to switch GadgetRepo implementation used
* Lazy-load the GadgetResourceLoaderModule class so we don't need to
load each individual gadget object unless its needed
Note that Special:Gadgets's export feature intentionally doesn't work
yet, and will be fixed in a follow up patch.
Bug: T106177
Change-Id: Ib11db5fb0f7b46793bfa956cf1367f1dc1059b1c
The time has come to stop supporting legacy gadgets that haven't
migrated to ResourceLoader yet.
For many Gadgets, migrating to ResourceLoader will be as easy
as adding "[ResourceLoader]" to its definition on MediaWiki:Gadgets-definition.
However for older gadgets, they may need more maintenance. Though
similarly they may've already been malfunctioning silently.
The most common techniques used by legacy scripts, and what their
equivalents are in modern JavaScript, see:
<https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)>
Ref T107399.
Change-Id: Ia5f7323a40a28541515ef3a3f5079f1cc940f392
GadgetRepo is an abstract class based off of the implementation in the
RL2 branch.
It is a singleton that provides basic methods to construct and interact
with Gadget objects.
The MediaWikiGadgetsDefinition class is an implementation of GadgetsRepo
that parses the "MediaWiki:Gadgets-definition" page for gadget
definitions.
Tests were left in place to demonstrate that no functional changes have
been made aside from relocation of code. Some tests should be moved to
separate files in the future.
Bug: T106176
Change-Id: I3e802889f6f495783f4dbac65c2a8cefa824a778
Removing the links to edit the UI messages means it's necessary to dig around and guess at names to update the gadget descriptions. IMHO this is pretty terrible, and definitely a step backwards in usability.
* (bug 12211) Show some gadgets only for admins
* (bug 13742) Allow for gadgets to be turned on by default
I'm a bit leery of the 'on by default' entirely at the moment. :)
A few comments:
* The readme examples don't seem to clearly show the option format
* Why are numeric constants being used as indexes to the option array? Strings are easier to work with and debug.
* There's a lot of stuff like this which feels very ugly:
if( isset( $gadget->options[Gadget::RIGHTS] ) && !empty( $gadget->options[Gadget::RIGHTS] ) ) {
Since it's all hard-coded anyway, why not just do something nice and clear like this?
if( !empty( $gadget->rights ) ) {
* And this:
if( wfGadgetAllowed( $gadget->options ) ) {
to:
if( $gadget->isAllowed() ) {
* Use message prefixes to keep namespaces clean: 'gadget-' for gadget name and code, 'gadget-section-' for gadget sections
* Make link behavior consistent with capitallinks off
* Put headings outside the list in Special:Gadgets
* Some general code cleanup (ditch references, etc)