Page MenuHomePhabricator

Load license messages properly
Closed, ResolvedPublic

Description

Currently if one defines a new license in $wgMediaUploaderConfig['licenses'], its message is not loaded with MediaUploader's ResourceLoader module, unless it's explicitly listed in extension.json. Effectively, this means that wikis that want to define their custom licenses (e.g. Creative Commons NC or ND) have to fork the entire extension and add the relevant messages to the module definition. This makes the process rather hard for system admins, provided they come up with this at all, it took me a good few hours of debugging to even understand why these messages are not loaded, as this is not documented.

I propose removing the static list of license-related messages in extension.json entirely. These messages would be instead dynamically added to the module by subclassing ResourceLoaderFileModule and overriding the getMessages() method. The list of required messages would be obtained by simply looking at $wgMediaUploaderConfig['licenses'].

Note: it would be possible to load only the licenses that are actually used, not just defined in the licenses setting, but that would work only for the global config. If a campaign was to use a license not used in the global config, this setup would fail and there isn't really a way around this. I wouldn't call this a major issue, though, the performance difference would be probably negligible.

EDIT: there is a workaround for that, but it's very clunky. Something as complicated as this should never be needed.

Event Timeline

Change 672783 had a related patch set uploaded (by Ostrzyciel; owner: Ostrzyciel):
[mediawiki/extensions/MediaUploader@master] Load license messages based on config

https://gerrit.wikimedia.org/r/672783

Change 672783 merged by jenkins-bot:
[mediawiki/extensions/MediaUploader@master] Load license messages based on config

https://gerrit.wikimedia.org/r/672783