From: Kunal Mehta Date: Tue, 13 Sep 2016 04:29:41 +0000 (-0700) Subject: LocalIdLookup: Use DBAccessObjectUtils X-Git-Tag: 1.31.0-rc.0~5619^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=b95696f66fb3c3a11b6b73c72e020a273698797c;p=lhc%2Fweb%2Fwiklou.git LocalIdLookup: Use DBAccessObjectUtils This simplies some code that was re-implementing DBAccessObjectUtils::getDBOptions(). Change-Id: Ib446f43149abdf23f07f209ccd9698923f0a2c22 --- 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' ];