}
// Easy case, we're checking locally
- if ( $wikiId === null || $wikiId === wfWikiID() ) {
+ if ( $wikiId === null || WikiMap::isCurrentWikiId( $wikiId ) ) {
return true;
}
}
$audience = $this->checkAudience( $audience );
- $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
- $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' ];
}
$audience = $this->checkAudience( $audience );
- $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
- $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' ];