X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fuser%2FUserNamePrefixSearch.php;h=b7d5058211100bd7bf7922c627200e24e157ea14;hb=9189db0c50cd4f755efc1d0ce061f6c04b236a40;hp=f56526631550950343966fef4ec38715c392e2c0;hpb=0e289eae349ce35d03af3e8fc10e9ad2e0119f26;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/user/UserNamePrefixSearch.php b/includes/user/UserNamePrefixSearch.php index f565266315..b7d5058211 100644 --- a/includes/user/UserNamePrefixSearch.php +++ b/includes/user/UserNamePrefixSearch.php @@ -39,17 +39,17 @@ class UserNamePrefixSearch { public static function search( $audience, $search, $limit, $offset = 0 ) { $user = User::newFromName( $search ); - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $prefix = $user ? $user->getName() : ''; - $tables = array( 'user' ); - $cond = array( 'user_name ' . $dbr->buildLike( $prefix, $dbr->anyString() ) ); - $joinConds = array(); + $tables = [ 'user' ]; + $cond = [ 'user_name ' . $dbr->buildLike( $prefix, $dbr->anyString() ) ]; + $joinConds = []; // Filter out hidden user names if ( $audience === 'public' || !$audience->isAllowed( 'hideuser' ) ) { $tables[] = 'ipblocks'; - $cond['ipb_deleted'] = array( 0, null ); - $joinConds['ipblocks'] = array( 'LEFT JOIN', 'user_id=ipb_user' ); + $cond['ipb_deleted'] = [ 0, null ]; + $joinConds['ipblocks'] = [ 'LEFT JOIN', 'user_id=ipb_user' ]; } $res = $dbr->selectFieldValues( @@ -57,14 +57,14 @@ class UserNamePrefixSearch { 'user_name', $cond, __METHOD__, - array( + [ 'LIMIT' => $limit, 'ORDER BY' => 'user_name', 'OFFSET' => $offset - ), + ], $joinConds ); - return $res === false ? array() : $res; + return $res === false ? [] : $res; } }