2008/8/19 Andrew Garrett andrew@epstone.net
On Tue, Aug 19, 2008 at 4:15 AM, Victor Vasiliev vasilvv@gmail.com wrote:
- 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().
Good point, fixed in r39623.
He-he. I checked, it still works incorrectly: when array_merge_recursive() merges 'sysop' => array( 'importupload' =>true ) in DefaultSettings with 'sysop' => array( 'importupload' => false ) in InitialiseSettings as 'sysop' => array( 'importupload' => array( true, false ) ) (which works of course incorrect).
- 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.
DefaultSettings.php is already included by the time we extract wgConf. Extensions tend to arrays in-place, instead of replacing it by something new, i.e. $wgGroupPermissions['sysop']['move'] = true, rather than $wgGroupPermissions = array( 'sysop' => array( 'move' => true ) ); https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I know. Look: in Special:Userrights we have to determine $wgGroupPermissions of some other wiki. To use it, we have to get wiki-specific $wgGroupPermissions and merge them with default group permissions. Default group permissions are specified in extensions, DefaultSettings, etc. so it is nearly-impossible to get them all.
Another points: * If code invokes $wgConf->get( 'wgGroupPermissions' ), get() function should check for presence of settings with "+" in its name, and if it's present, merge returned value with default settings. * Some SpecialUserrights bugs: ** $wgConf->get( 'wgGroupPermissions', ... ) return null, since it is present in $wgConf as '+wgGroupPermissions' (see the point above) ** It does not exclude implicit groups