werdna(a)svn.wikimedia.org wrote:
> function extractGlobal( $setting, $wiki, $suffix, $params, $wikiTags = array() ) {
> $value = $this->get( $setting, $wiki, $suffix, $params, $wikiTags );
> if ( !is_null( $value ) ) {
> - $GLOBALS[$setting] = $value;
> + if (substr($setting,0,1) == '+'&& is_array($value)) {
> + $setting = substr($setting,1);
> + if ( is_array($GLOBALS[$setting]) ) {
> + $GLOBALS[$setting] = array_merge( $GLOBALS[$setting], $value );
> + } else {
> + $GLOBALS[$setting] = $value;
> + }
> + } else {
> + $GLOBALS[$setting] = $value;
> + }
> }
> }
* Note that extractGlobal() is not used on Wikimedia.
* extractGlobal() supposes that configuration variable has a "+" prefix,
while get() supposes that target wiki should have it.
* Mergability should be property of a configuration variable (so we use
"+wgGroupPermissions" instead of "wgGroupPermissions" => array(
"+enwiki" => ... ).
* It doesn't seem to merge arrays recursively. That means that in
"wgGroupPermissions" => array(
'default' => array( 'user' => array( 'something' => true ) ),
'enwiki' => array( 'user' => array( 'somthingelse' => true ) ),
) enwiki settings will override defaults, therefore you should use
array_merge_recursive().
* If we want it to be usable for other parts of the code which are ran
when $wgConf is already extracted, we need to know default settings. To
determine default settings it's possible to include DefaultSettings.php
in the local scope and get a value of the configuration variable, but it
does not work with group permissions since they are modified by
extensions + CommonSettings.php also modifies them.
--vvv