Last modified: 2014-02-12 23:38:09 UTC
I wanted to allow users to upload copyrighted content on a private wiki. Unfortunately there is no license for "copyrighted" content, so I tried to create my own entry in the available license list. This seems to be not feasible. The first problem is that you can not really edit the default configuration of the WikiEditor. You can only create your own configuration hash table which will be merged with the default configuration hash (PHP array_merge function). If this approache works for scalar hash values, this does not work at all for complex ones (and the configuration hash has plenty of them). I think there, that the default configuration should be global and already declared as $wgUploadWizardConfig. It would be easy afterward to customise it. The second problem seems to be with the string translation. You can't create easily your own license description (in the "licenses" hash) without having to declare somewhere translated strings. One solution for my own use case would be to patch the default WikiEditor configuration file and add an entry for the copyrighted content... But, I guess there are other people who want to introduce their own custom license.
Sorry, this bug report is about the UploadWizard, not about WikiEditor.
You can add new licenses by accessing the global config variable as follows $wgUploadWizardConfig[ 'licenses' ]['your-own-license-name'] => array( 'msg' => 'xyz', 'icons' => array(), 'url' => '//example.org/' ); The only problem I see is adding a msg, it should be a feature to add a translation in LocalSettings.php but I don't think that is possible right now (should ask the in #mediawiki-i18n). However a workaround is to create a simple extension and add those messages using that. Closing this as fixed.
> The only problem I see is adding a msg, it should be a feature to add a > translation in LocalSettings.php but I don't think that is possible right now > (should ask the in #mediawiki-i18n). However a workaround is to create a > simple > extension and add those messages using that. For proper copyright tags, Wikimedia projects use WikimediaMessages extension. https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/WikimediaMessages.git;a=blob;f=WikimediaCCLicenseTexts.i18n.php If it's just a single (fake?) license, can't one just set $wgUploadWizardConfig and hen add a custom system message on wiki? That would be weird and should be filed as a bug.
@Nischay Nahata I have added your code to my LocalSetting.php $wgUploadWizardConfig[ 'licenses' ]['your-own-license-name'] => array( 'msg' => 'xyz', 'icons' => array(), 'url' => '//example.org/' ); Unfortunately, this breaks Mediawiki: PHP message: PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW So, I reopen the ticket.
Just get rid of the arrow and use an equals sign: $wgUploadWizardConfig[ 'licenses' ]['your-own-license-name'] = array( 'msg' => 'xyz', 'icons' => array(), 'url' => '//example.org/' );
This does not work either (at least for me). I'm stuck in the "upload" stage and nothing happens if I click on the "continue" button. In addition I do not see how $wgUploadWizardConfig could alone fix the problem as the available licenses seem to be configured in 'licensesThirdParty' and 'licensesOwnWork'. So, I reopen the ticket.
Actually the $wgUploadWizardConfig is not like other config vars where we can just add new values... because its using array_merge() afterwards. So we need to use $wgUploadWizardConfig = array( 'licenses' = array( 'custom' => array( 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0', 'icons' => array( 'cc-by', 'cc-sa' ), 'url' => '//creativecommons.org/licenses/by-sa/3.0/' ) ) ); But this again won't work because we aren't using array_merge_recursive().. I will try a fix in some time. However, even then this won't show on UW as it needs to be grouped in either own work or third party :(
Sorry the above code is erroneous, you can use $wgUploadWizardConfig = array( 'licenses' => array( 'custom' => array( 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0', 'icons' => array( 'cc-by', 'cc-sa' ), 'url' => '//creativecommons.org/licenses/by-sa/3.0/' ) ), 'licensesOwnWork' => array( 'type' => 'or', 'filterTemplate' => 'self', 'licenses' => array( 'custom' ), ), ); in LocalSettings.php after applying https://gerrit.wikimedia.org/r/#/c/49849/ This shows me the license under own work, similarly you can do for third party licenses.
Fixes it for me, merged.
It seems to me that the recursive array merge for the config is a good start, but this does not fix the whole problem: * You still can't specify your license message * You still can't use it as the default license * Unable to easily use the configured template Recursive array merge does not make sense for all values. For example, the 'licensesOwnWork' keys 'defaults' and 'licenses' should not be merged but overwritten. I still thing the best way is not to merge two config arrays, but to make the default config array directly modifiable. The other problem, is that it seems impossible to have your own license message ('msg') also if you have specified it in the "Mediawiki" namespace. I guess that UW does not care if the msg key ('mwe-upwiz-license-copyrighted' in my case) is not translated somewhere else in the extension. This should be able to bypass that. I also think this should be possible to somehow harcode the message in the configuration itself by using a new value like for example "msghard". The config. specified "template" is not directly used but the description page is based on a complex system relying on other templates like "self". This templates are not installed per default, so I see only two solutions: the templates is created by UW or we find a solution to use directly the template specified in the configuration.
Well this will be a lot of work, unfortunately UploadWizard isn't made so generic that it can be used outside of WMF wikis.
(In reply to comment #9) > Fixes it for me, merged. Revert committed, Gerrit change #53137
Unfortunately this attempted fix messed up the Commons local configuration by incorrectly merging the config array with the default settings.