Allow customizing the prefix used when configuration settings are expanded into $GLOBALS. Right now "wg" is hardcoded which sucks :(
Description
Details
Status | Subtype | Assigned | Task | |
---|---|---|---|---|
· · · | ||||
Resolved | Anomie | T87998 Convert WikimediaIncubator to use extension registration | ||
Resolved | Legoktm | T97186 Allow setting custom prefixes for config settings in extension.json ("wg" is hardcoded right now) | ||
· · · |
Event Timeline
Please explain which problem you would like to solve - see https://www.mediawiki.org/wiki/How_to_report_a_bug
Hi this is not a problem this is a suggestion to stop using wg by default and allow prefix or non prefix support.
The problem is when converting skins and extensions to use the new extension registration and the skins and extensions have for example a mix of $wgname and $name it wont convert the $name but will for $wgname.
@Legoktm nope doint know any extensions that are in the tarball that doint use non prefix settings.
This should be rated high so that it can be backported to Mediawiki 1.25 before released.
I found the lines that is hard coded for wg
the code is
foreach ( $info as $key => $val ) { if ( in_array( $key, self::$globalSettings ) ) { $this->storeToArray( "wg$key", $val, $this->globals ); // Ignore anything that starts with a @ } elseif ( $key[0] !== '@' && !in_array( $key, $this->processed ) ) { $this->storeToArray( $key, $val, $this->attributes ); } }
and
protected function extractConfig( array $info ) { if ( isset( $info['config'] ) ) { foreach ( $info['config'] as $key => $val ) { if ( $key[0] !== '@' ) { $this->globals["wg$key"] = $val; } } $this->processed[] = 'config'; } }
Change 209251 had a related patch set uploaded (by Paladox):
Remove hardcoded wg from config in extension registration
Change 209252 had a related patch set uploaded (by Paladox):
Remove hardcoded wg from config in extension registration
Change 209252 abandoned by Paladox:
Remove hardcoded wg from config in extension registration
Change 209255 abandoned by Legoktm:
Add wg prefix in config
Reason:
As discussed, we're not doing this.
How can this be achieved. Why not just upload this change then upload changes for extensions and skins then merge at same time. This way is better. Since this way can only be achieved.
Because that will result in a breaking change, which we are trying very hard to not cause.
This should be high or at least normal because this blocks other extension/skin that doing use wg prefix in there config.
I copy the part of my gerrit command here, that explains why I think, that this task should be closed as declined:
I'm totally against this change. The wg prefix is a standard for configuration options in MediaWiki. Not only ExtenRegistration requires it, the Config object does it, too, for a good reason. If any extension or skin has config options without the wg prefix, this should be changed before converting it to ExtensionRegistration.
Ok. Currently The incubation extension doesent follow mediawiki standards it dosent use the wg prefix so is blocked by this task.
I think it would be much easier to convert the Incubator extension to use the wg prefix for it's config options (in a compatible way, without breaking existing setup), instead of implementing exceptions for any kind of problems we may encounter in converting extensions to ExtensionRegistration (or, in a bigger view, to the Config object, too). That's my opinion, I don't know, how other think about that :)
Ok I currently have a patch waiting that does this I also updated the Wikimedia file. Once someone agrees that it can be merged the documentation on wiki can be updated.
Please also remember that this is a BREAKING change for a minimum of 10 to 15 % of all third party wikis. I understand that this issue was or will be publicised and documented prominently if this has not been done already.
@Kghbln: Do you mean Paladaox change for WikimediaIncubator or fo you mean change https://gerrit.wikimedia.org/r/#/c/231244/ ? :)
Change 231244 abandoned by Paladox:
Support custom prefix
Reason:
I am not quite sure how to do this so abandoning.
Change 209251 abandoned by Paladox:
Remove hardcoded wg from config in extension registration
I might be missing something, but I don't see how this is a breaking change for wikis. Extensions that don't use a "wg" prefix should not migrate to extension registration until this bug is fixed.
Extensions that don't use a "wg" prefix should not migrate to extension registration until this bug is fixed.
At the time I wrote this I was under the clear impression that it was decided not to fix this. In this case it is indeed breaking.
Change 233331 had a related patch set uploaded (by Legoktm):
registration: Allow custom prefixes for configuration settings
Change 233331 merged by jenkins-bot:
registration: Allow custom prefixes for configuration settings
@Legoktm how would I use the new custom prefix for wikimediaincubator is there any example for wikimediaincubator so that it can start converting to extension.json.
Use something like:
{ "config": { "_prefix": "wminc", "Pref": "incubatortestwiki" } }
Change 237975 had a related patch set uploaded (by Legoktm):
registration: Allow custom prefixes for configuration settings
Change 237975 merged by jenkins-bot:
registration: Allow custom prefixes for configuration settings
There should be array support and maybe something like
"_prefix-1": "wminc", This should be either { or [
"ConfigGoes here": This can be either { or [
And then code goes here
Either } or ] here and same again.
And then "_prefix-2": "example", for second config if it is different Since some configs have a wg prefix which would affect all configs. Making it hard to use non prefixed and prefixed ones.