A couple of stylistic comments on this.
array_intersect( (array)$removegroup, $changeable['remove'] ) );
array_intersect( (array)$removegroup, $changeable[1] ) ); $addgroup = array_unique(
array_intersect( (array)$addgroup, $changeable['add'] ) );
array_intersect( (array)$addgroup, $changeable[0] ) );
Numeric indexes are much less readable than string indexes in this case. If you really want you could use named constants, but you really should not use magical meanings like 1 = remove, 0 = add. It's confusing.
switch($retval[0])
{
While this is a stylistic quibble, MediaWiki code does consistently use K&R-style braces, with the opening brace on the same line, i.e.:
switch($retval[0]) {
This is documented in docs/design.txt, and helps to give the code a more consistent look.
function fetchUser_real( $username ) {
Likewise, we only rarely use underscores. This should have been fetchUserReal. Consistent function naming conventions make things easier to remember and work with: you only have to remember the function's name, not the name *plus* how the name is formatted.
Simetrical schreef:
Numeric indexes are much less readable than string indexes in this case. If you really want you could use named constants, but you really should not use magical meanings like 1 = remove, 0 = add. It's confusing.
I had to use numeric indexes, because I switched to another function (splitGroups()) that returns an array with numeric indexes. Can't really help that other than by changing splitGroups() and breaking stuff, something I don't like to do. Comments on brace style and underscores are duly noted.
Roan Kattouw (Catrope)
wikitech-l@lists.wikimedia.org