MediaWiki master
MediaWiki\User\UserSelectQueryBuilder Class Reference

Inherits Wikimedia\Rdbms\SelectQueryBuilder.

Collaboration diagram for MediaWiki\User\UserSelectQueryBuilder:

Public Member Functions

 __construct (IReadableDatabase $db, ActorStore $actorStore, TempUserConfig $tempUserConfig, HideUserUtils $hideUserUtils)
 
 anon ()
 Only return anonymous users.
 
 fetchUserIdentities ()
 Fetch UserIdentities for the specified query.
 
 fetchUserIdentity ()
 Fetch a single UserIdentity that matches specified criteria.
 
 fetchUserNames ()
 Returns an array of user names matching the query.
 
 hidden (bool $hidden)
 Filter based on user hidden status.
 
 named ()
 Only return named users.
 
 orderByName (string $dir=self::SORT_ASC)
 Order results by name in $direction.
 
 orderByUserId (string $dir=self::SORT_ASC)
 Order results by user id.
 
 registered ()
 Only return registered users.
 
 temp ()
 Only return temp users.
 
 userIds ( $userIds)
 Find by provided user ids.
 
 userNamePrefix (string $prefix)
 Find users with names starting from the provided prefix.
 
 userNames ( $userNames)
 Find by provided user names.
 
 whereRegisteredTimestamp (string $timestamp, bool $direction)
 Find registered users who registered.
 
 whereUserIds ( $userIds)
 Find by provided user ids.
 
 whereUserNamePrefix (string $prefix)
 Find users with names starting from the provided prefix.
 
 whereUserNames ( $userNames)
 Find by provided user names.
 
- Public Member Functions inherited from Wikimedia\Rdbms\SelectQueryBuilder
 __construct (IReadableDatabase $db)
 Only for use in subclasses.
 
 acquireRowLocks ()
 Execute the query, but throw away the results.
 
 andWhere ( $conds)
 Add conditions to the query.
 
 bigResult ()
 Enable the SQL_BIG_RESULT option.
 
 bufferResult ()
 Enable the SQL_BUFFER_RESULT option.
 
 buildGroupConcatField ( $delim)
 Build a GROUP_CONCAT or equivalent statement for a query.
 
 calcFoundRows ()
 Enable the SQL_CALC_FOUND_ROWS option.
 
 caller ( $fname)
 Set the method name to be included in an SQL comment.
 
 clearFields ()
 Remove all fields from the query.
 
 conds ( $conds)
 Add conditions to the query.
 
 connection (IReadableDatabase $db)
 Change the IReadableDatabase object the query builder is bound to.
 
 distinct ()
 Enable the DISTINCT option.
 
 estimateRowCount ()
 Estimate the number of rows in dataset.
 
 explain ()
 Make the query be an EXPLAIN SELECT query instead of a SELECT query.
 
 fetchField ()
 Run the constructed SELECT query, and return a single field extracted from the first result row.
 
 fetchFieldValues ()
 Run the constructed SELECT query, and extract a single field from each result row, returning an array containing all the values.
 
 fetchResultSet ()
 Run the constructed SELECT query and return all results.
 
 fetchRow ()
 Run the constructed SELECT query, and return the first result row.
 
 fetchRowCount ()
 Run the SELECT query, and return the number of results.
 
 field ( $field, $alias=null)
 Add a single field to the query, optionally with an alias.
 
 fields ( $fields)
 Add a field or an array of fields to the query.
 
 forUpdate ()
 Enable the FOR UPDATE option.
 
 from ( $table, $alias=null)
 Add a single table to the SELECT query.
 
 getQueryInfo ( $joinsName='join_conds')
 Get an associative array describing the query in terms of its raw parameters to IReadableDatabase::select().
 
 getSQL ()
 Get the SQL query string which would be used by fetchResultSet().
 
 groupBy ( $group)
 Add a GROUP BY clause.
 
 having ( $having)
 Add a HAVING clause.
 
 ignoreIndex ( $index)
 Set the IGNORE INDEX option.
 
 joinConds (array $joinConds)
 Manually append to the $join_conds array which will be passed to IReadableDatabase::select().
 
 limit ( $limit)
 Set the query limit.
 
 lockInShareMode ()
 Enable the LOCK IN SHARE MODE option.
 
 merge (SelectQueryBuilder $builder)
 Merge another query builder with this one.
 
 newJoinGroup ()
 Create a parenthesized group of joins which can be added to the object like a table.
 
 newSubquery ()
 Get an empty SelectQueryBuilder which can be used to build a subquery of this query.
 
 offset ( $offset)
 Set the offset.
 
 option ( $name, $value=null)
 Manually set an option in the $options array to be passed to IReadableDatabase::select()
 
 options (array $options)
 Manually set multiple options in the $options array to be passed to IReadableDatabase::select().
 
 orderBy ( $fields, $direction=null)
 Set the ORDER BY clause.
 
 queryInfo ( $info)
 Set the query parameters to the given values, appending to the values which were already set.
 
 rawTables ( $tables)
 Given a table or table array as might be passed to IReadableDatabase::select(), append it to the existing tables, interpreting nested arrays as join groups.
 
 recency ( $recency)
 
 select ( $fields)
 Add a field or an array of fields to the query.
 
 setMaxExecutionTime (int $time)
 Set MAX_EXECUTION_TIME for queries.
 
 smallResult ()
 Enable the SQL_SMALL_RESULT option.
 
 straightJoinOption ()
 Enable the STRAIGHT_JOIN query option.
 
 tables ( $tables)
 Add multiple tables.
 
 useIndex ( $index)
 Set a USE INDEX option.
 
 where ( $conds)
 Add conditions to the query.
 
- Public Member Functions inherited from Wikimedia\Rdbms\JoinGroupBase
 join ( $table, $alias=null, $conds=[])
 Inner join a table or group of tables.
 
 leftJoin ( $table, $alias=null, $conds=[])
 Left join a table or group of tables.
 
 straightJoin ( $table, $alias=null, $conds=[])
 Straight join a table or group of tables.
 
 table ( $table, $alias=null)
 Add a single table or a single parenthesized group.
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\Rdbms\SelectQueryBuilder
const SORT_ASC = 'ASC'
 sort the results in ascending order
 
const SORT_DESC = 'DESC'
 sort the results in descending order
 
- Protected Member Functions inherited from Wikimedia\Rdbms\SelectQueryBuilder
 getAutoAlias ()
 Get a table alias which is unique to this SelectQueryBuilder.
 
 getCaller ()
 get the method name of the caller, for use in sub classes
 
- Protected Attributes inherited from Wikimedia\Rdbms\SelectQueryBuilder
IReadableDatabase IReadableDatabase $db
 
array $options = []
 The options to be passed to IReadableDatabase::select()
 
- Protected Attributes inherited from Wikimedia\Rdbms\JoinGroupBase
array $joinConds = []
 
string null $lastAlias
 
array $tables = []
 

Detailed Description

Definition at line 33 of file UserSelectQueryBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\UserSelectQueryBuilder::__construct ( IReadableDatabase $db,
ActorStore $actorStore,
TempUserConfig $tempUserConfig,
HideUserUtils $hideUserUtils )

Member Function Documentation

◆ anon()

MediaWiki\User\UserSelectQueryBuilder::anon ( )

Only return anonymous users.

Returns
UserSelectQueryBuilder

Definition at line 194 of file UserSelectQueryBuilder.php.

◆ fetchUserIdentities()

MediaWiki\User\UserSelectQueryBuilder::fetchUserIdentities ( )

Fetch UserIdentities for the specified query.

Returns
Iterator<UserIdentity>

Definition at line 262 of file UserSelectQueryBuilder.php.

◆ fetchUserIdentity()

MediaWiki\User\UserSelectQueryBuilder::fetchUserIdentity ( )

Fetch a single UserIdentity that matches specified criteria.

Returns
UserIdentity|null

Definition at line 248 of file UserSelectQueryBuilder.php.

◆ fetchUserNames()

MediaWiki\User\UserSelectQueryBuilder::fetchUserNames ( )

Returns an array of user names matching the query.

Returns
string[]

Definition at line 277 of file UserSelectQueryBuilder.php.

◆ hidden()

MediaWiki\User\UserSelectQueryBuilder::hidden ( bool $hidden)

Filter based on user hidden status.

Since
1.38
Parameters
bool$hiddenTrue - only hidden users, false - no hidden users
Returns
$this

Definition at line 234 of file UserSelectQueryBuilder.php.

◆ named()

MediaWiki\User\UserSelectQueryBuilder::named ( )

Only return named users.

Returns
UserSelectQueryBuilder

Definition at line 204 of file UserSelectQueryBuilder.php.

◆ orderByName()

MediaWiki\User\UserSelectQueryBuilder::orderByName ( string $dir = self::SORT_ASC)

Order results by name in $direction.

Parameters
string$dirone of self::SORT_ASC or self::SORT_DESC
Returns
UserSelectQueryBuilder

Definition at line 163 of file UserSelectQueryBuilder.php.

◆ orderByUserId()

MediaWiki\User\UserSelectQueryBuilder::orderByUserId ( string $dir = self::SORT_ASC)

Order results by user id.

Parameters
string$dirone of self::SORT_ASC or self::SORT_DESC
Returns
UserSelectQueryBuilder

Definition at line 174 of file UserSelectQueryBuilder.php.

◆ registered()

MediaWiki\User\UserSelectQueryBuilder::registered ( )

Only return registered users.

Returns
UserSelectQueryBuilder

Definition at line 184 of file UserSelectQueryBuilder.php.

◆ temp()

MediaWiki\User\UserSelectQueryBuilder::temp ( )

Only return temp users.

Returns
UserSelectQueryBuilder

Definition at line 218 of file UserSelectQueryBuilder.php.

◆ userIds()

MediaWiki\User\UserSelectQueryBuilder::userIds ( $userIds)

Find by provided user ids.

Deprecated
since 1.37, use whereUserIds instead
Parameters
int | int[]$userIds
Returns
UserSelectQueryBuilder

Definition at line 76 of file UserSelectQueryBuilder.php.

◆ userNamePrefix()

MediaWiki\User\UserSelectQueryBuilder::userNamePrefix ( string $prefix)

Find users with names starting from the provided prefix.

Note
this could produce a huge number of results, like User00000 ... User99999, so you must set a limit when using this condition.
Deprecated
since 1.37 use whereUserNamePrefix instead
Parameters
string$prefix
Returns
UserSelectQueryBuilder

Definition at line 133 of file UserSelectQueryBuilder.php.

◆ userNames()

MediaWiki\User\UserSelectQueryBuilder::userNames ( $userNames)

Find by provided user names.

Deprecated
since 1.37, use whereUserNames instead
Parameters
string | string[]$userNames
Returns
UserSelectQueryBuilder

Definition at line 101 of file UserSelectQueryBuilder.php.

◆ whereRegisteredTimestamp()

MediaWiki\User\UserSelectQueryBuilder::whereRegisteredTimestamp ( string $timestamp,
bool $direction )

Find registered users who registered.

Parameters
string$timestamp
bool$directionDirection flag (if true, user_registration must be before $timestamp)
Since
1.42
Returns
UserSelectQueryBuilder

Definition at line 145 of file UserSelectQueryBuilder.php.

◆ whereUserIds()

MediaWiki\User\UserSelectQueryBuilder::whereUserIds ( $userIds)

Find by provided user ids.

Parameters
int | int[]$userIds
Returns
UserSelectQueryBuilder

Definition at line 64 of file UserSelectQueryBuilder.php.

◆ whereUserNamePrefix()

MediaWiki\User\UserSelectQueryBuilder::whereUserNamePrefix ( string $prefix)

Find users with names starting from the provided prefix.

Note
this could produce a huge number of results, like User00000 ... User99999, so you must set a limit when using this condition.
Parameters
string$prefix
Returns
UserSelectQueryBuilder

Definition at line 114 of file UserSelectQueryBuilder.php.

◆ whereUserNames()

MediaWiki\User\UserSelectQueryBuilder::whereUserNames ( $userNames)

Find by provided user names.

Parameters
string | string[]$userNames
Returns
UserSelectQueryBuilder

Definition at line 86 of file UserSelectQueryBuilder.php.


The documentation for this class was generated from the following file: