From: UltrasonicNXT Date: Wed, 5 Feb 2014 21:03:15 +0000 (+0000) Subject: Fix userrights-interwiki when the 'user' table is shared X-Git-Tag: 1.31.0-rc.0~14483 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=9d68a8718f751d1864416e4f076fbcceaeff57db;p=lhc%2Fweb%2Fwiklou.git Fix userrights-interwiki when the 'user' table is shared At present, this function selects the user table from the same DB as the user_groups, however, in wikifarms this is not often the case, as the user table is often shared, but the user_groups table not. Adding a check in here, and passing the shared table, if needed, ONLY to the user query, should fix. Change-Id: Ib85630067c402b8e4f50ff11a33fe7f0eadd4f16 --- diff --git a/includes/UserRightsProxy.php b/includes/UserRightsProxy.php index e3655ceddb..53c69d817a 100644 --- a/includes/UserRightsProxy.php +++ b/includes/UserRightsProxy.php @@ -113,12 +113,23 @@ class UserRightsProxy { * @return null|UserRightsProxy */ private static function newFromLookup( $database, $field, $value, $ignoreInvalidDB = false ) { + global $wgSharedDB, $wgSharedTables; + // If the user table is shared, perform the user query on it, but don't pass it to the UserRightsProxy, + // as user rights are normally not shared. + if ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) { + $userdb = self::getDB( $wgSharedDB, $ignoreInvalidDB ); + } else { + $userdb = self::getDB( $database, $ignoreInvalidDB ); + } + $db = self::getDB( $database, $ignoreInvalidDB ); - if ( $db ) { - $row = $db->selectRow( 'user', + + if ( $db && $userdb ) { + $row = $userdb->selectRow( 'user', array( 'user_id', 'user_name' ), array( $field => $value ), __METHOD__ ); + if ( $row !== false ) { return new UserRightsProxy( $db, $database, $row->user_name,