From b95696f66fb3c3a11b6b73c72e020a273698797c Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Mon, 12 Sep 2016 21:29:41 -0700 Subject: [PATCH] LocalIdLookup: Use DBAccessObjectUtils This simplies some code that was re-implementing DBAccessObjectUtils::getDBOptions(). Change-Id: Ib446f43149abdf23f07f209ccd9698923f0a2c22 --- includes/user/LocalIdLookup.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/user/LocalIdLookup.php b/includes/user/LocalIdLookup.php index 0d8b1a8ede..0a345540ff 100644 --- a/includes/user/LocalIdLookup.php +++ b/includes/user/LocalIdLookup.php @@ -60,10 +60,8 @@ class LocalIdLookup extends CentralIdLookup { } $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' ]; @@ -93,10 +91,8 @@ class LocalIdLookup extends CentralIdLookup { } $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' ]; -- 2.20.1