* $wgSharedDB and $wgSharedTables set, and that all wikis involved in the
* sharing are listed in $wgLocalDatabases, and that no wikis not involved in
* the sharing are listed in $wgLocalDatabases.
* $wgSharedDB and $wgSharedTables set, and that all wikis involved in the
* sharing are listed in $wgLocalDatabases, and that no wikis not involved in
* the sharing are listed in $wgLocalDatabases.
- $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_SLAVE );
- $options = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING )
- ? array( 'LOCK IN SHARE MODE' )
- : array();
+ list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags );
+ $db = wfGetDB( $index );
- $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_SLAVE );
- $options = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING )
- ? array( 'LOCK IN SHARE MODE' )
- : array();
+ list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags );
+ $db = wfGetDB( $index );