77 public function search( $audience,
string $search,
int $limit,
int $offset = 0 ): array {
78 if ( $audience !== self::AUDIENCE_PUBLIC &&
81 throw new InvalidArgumentException(
82 '$audience must be AUDIENCE_PUBLIC or an Authority object'
87 $prefix = $this->userNameUtils->getCanonical( $search ) ?:
'';
89 $dbr = $this->dbProvider->getReplicaDatabase();
90 $queryBuilder = $dbr->newSelectQueryBuilder()
91 ->select(
'user_name' )
93 ->where( $dbr->expr(
'user_name', IExpression::LIKE,
new LikeValue( $prefix, $dbr->anyString() ) ) )
94 ->orderBy(
'user_name' )
99 if ( $audience === self::AUDIENCE_PUBLIC || !$audience->isAllowed(
'hideuser' ) ) {
100 $queryBuilder->andWhere( $this->hideUserUtils->getExpression( $dbr ) );
103 return $queryBuilder->caller( __METHOD__ )->fetchFieldValues();