Hi all,
(Reposting https://www.mediawiki.org/wiki/Topic:Tyvfh19mba4pway9 here to garner more input.)
I'm working on Extension:GlobalPreferences and trying to figure out how best to do things with all preferences, after they've been defined (in order to show various extra Preferences-form bits and pieces that depend on knowing about all preferences). At the moment, we're using $wgExtensionFunctions and hacking the $wgHooks global to add a new callback at the end of $wgHooks['GetPreferences'].
One idea is to add a new MediaWiki service called 'PreferencesFactory', that can be used to retrieve a new Preferences object. Extensions would then be able to use the MediaWikiServices hook to redefine the PreferencesFactory (with MediaWikiServices::redefineService()). Of course, only one extension would be able to do that (which maybe is a bit odd).
Apart from being able to override the Preferences class, a service for this would also mean the Preferences class could be refactored (gradually?) to not be such a collection of static methods.
The proposed patch is: https://gerrit.wikimedia.org/r/#/c/374451/
I'd love to hear anyone's ideas about this, including completely different and better ways to do things. :-)
Another idea is to add a new hook, after GetPreferences. This wouldn't be as flexible as the PreferencesFactory idea, but is a lot simpler.
Thanks, Sam.
On Wed, 11 Oct 2017, at 9:43 AM, Sam Wilson wrote:
One idea is to add a new MediaWiki service called 'PreferencesFactory',
This proposal now looks like this: https://gerrit.wikimedia.org/r/#/c/389665/
If anyone else has time for a bit of a look before xmas, that'd be wizard!
:)
wikitech-l@lists.wikimedia.org