Brion Vibber wrote:
I'm not a real MediaWiki developer, so it may be a silly question: How hard it is to convert a gadget into an extension? If it's not too hard, wouldn't it be better to redo useful gadgets as extensions? Unless i miss something very basic, this will make them easier to maintain, install, update and localize.
In principle, making an extension based on an existing Gadget should be pretty straightforward, especially with ResourceLoader taking care of more of the details of JS & CSS fetching.
Might be fun to whip up a how-to guide and post it on the tech blog...
That seems like a bit of a regression, though. The Gadgets extension was implemented as a way for local admins to easily hook into Special:Preferences so that typical users could enable certain pieces of JavaScript without needing to edit any pages.
By creating separate extensions for individual JavaScript gadgets, you hit some interesting benefits/detriments:
Benefits: * extensions can easily be enabled globally * extensions have great localization support * extensions have sane review processes in place * extensions can implement functionality when JavaScript isn't available
Detriments: * extensions usually take one forever to get enabled (this is a huge point) * extensions generally have an expectation that they will have non-JS support in them (that's why you're presumably coding in PHP) * extensions can't be updated as easily (static JavaScript pages in SVN, etc.)
You're absolutely correct that the UI for adding Gadgets is bad. Ideally it would use a Special page and some... actual UI to add/remove/modify/duplicate individual gadgets, but then you run into the problem of the storage backend. All the data is stored in MediaWiki pages, so you end up with a front-end UI monster similar to Special:CentralNotice, which probably adds more problems than it solves.
In the case of gadgets, I mostly agree with Tobias: better global support is needed. Though instead of the interwiki transclusion/marking certain pages/etc. hackery, I think global preferences (and by extension, global gadgets) make much more sense. Centralize the "add a purge link" scripts at Meta-Wiki and let everyone use the same code. That seems like a more sane approach than creating Extension:AddAPurgeLink, even if it is easier now with the implementation of ResourceLoader. :-)
MZMcBride