25use InvalidArgumentException;
42 public const AUDIENCE_PUBLIC =
'public';
45 private $loadBalancer;
48 private $userNameUtils;
58 $this->loadBalancer = $loadBalancer;
59 $this->userNameUtils = $userNameUtils;
73 public function search( $audience,
string $search,
int $limit,
int $offset = 0 ): array {
74 if ( $audience !== self::AUDIENCE_PUBLIC &&
77 throw new InvalidArgumentException(
78 '$audience must be AUDIENCE_PUBLIC or an Authority object'
83 $prefix = $this->userNameUtils->getCanonical( $search ) ?:
'';
88 $conds = [
'user_name ' .
$dbr->buildLike( $prefix,
$dbr->anyString() ) ];
92 if ( $audience === self::AUDIENCE_PUBLIC || !$audience->isAllowed(
'hideuser' ) ) {
93 $tables[] =
'ipblocks';
94 $conds[
'ipb_deleted'] = [ 0, null ];
95 $joinConds[
'ipblocks'] = [
'LEFT JOIN',
'user_id=ipb_user' ];
105 'ORDER BY' =>
'user_name',
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.