Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
[lhc/web/wiklou.git] / includes / user / LocalIdLookup.php
index f7c5408..ca3db5b 100644 (file)
@@ -41,7 +41,7 @@ class LocalIdLookup extends CentralIdLookup {
                }
 
                // Easy case, we're checking locally
-               if ( $wikiId === null || $wikiId === wfWikiID() ) {
+               if ( $wikiId === null || WikiMap::isCurrentWikiId( $wikiId ) ) {
                        return true;
                }
 
@@ -60,10 +60,8 @@ class LocalIdLookup extends CentralIdLookup {
                }
 
                $audience = $this->checkAudience( $audience );
-               $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_SLAVE );
-               $options = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING )
-                       ? [ 'LOCK IN SHARE MODE' ]
-                       : [];
+               list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags );
+               $db = wfGetDB( $index );
 
                $tables = [ 'user' ];
                $fields = [ 'user_id', 'user_name' ];
@@ -93,10 +91,8 @@ class LocalIdLookup extends CentralIdLookup {
                }
 
                $audience = $this->checkAudience( $audience );
-               $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_SLAVE );
-               $options = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING )
-                       ? [ 'LOCK IN SHARE MODE' ]
-                       : [];
+               list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags );
+               $db = wfGetDB( $index );
 
                $tables = [ 'user' ];
                $fields = [ 'user_id', 'user_name' ];