MediaWiki master
|
Helpers for building queries that determine whether a user is hidden. More...
Public Member Functions | |
addFieldToBuilder (SelectQueryBuilder $qb, $userIdField='user_id', $deletedFieldAlias='hu_deleted') | |
Add a field and related joins to the query builder. | |
getExpression (IReadableDatabase $dbr, string $userIdField='user_id', $status=self::SHOWN_USERS) | |
Get an SQL expression suitable for use in WHERE clause which will be true for either hidden or non-hidden users as specified. | |
Public Attributes | |
const | HIDDEN_USERS = 2 |
Select users that are hidden. | |
const | SHOWN_USERS = 1 |
Select users that are not hidden. | |
Helpers for building queries that determine whether a user is hidden.
Definition at line 12 of file HideUserUtils.php.
MediaWiki\Block\HideUserUtils::addFieldToBuilder | ( | SelectQueryBuilder | $qb, |
$userIdField = 'user_id', | |||
$deletedFieldAlias = 'hu_deleted' ) |
Add a field and related joins to the query builder.
The field in the query result will be true if the user is hidden or false otherwise.
Note that a GROUP BY option will be set, to avoid duplicating the result row if the user is hidden by more than one block.
SelectQueryBuilder | $qb | The query builder to be modified |
string | $userIdField | The name of the user_id field to use in the join |
string | $deletedFieldAlias | The field alias which will contain the true if the user is deleted. |
Definition at line 69 of file HideUserUtils.php.
References Wikimedia\Rdbms\SelectQueryBuilder\newSubquery(), and Wikimedia\Rdbms\SelectQueryBuilder\select().
MediaWiki\Block\HideUserUtils::getExpression | ( | IReadableDatabase | $dbr, |
string | $userIdField = 'user_id', | ||
$status = self::SHOWN_USERS ) |
Get an SQL expression suitable for use in WHERE clause which will be true for either hidden or non-hidden users as specified.
The expression will contain a subquery.
IReadableDatabase | $dbr | |
string | $userIdField | The field to be used as the user_id when joining on block. Defaults to "user_id". |
int | $status | Either self::SHOWN_USERS or self::HIDDEN_USERS depending on what sort of user you want to match. |
Definition at line 36 of file HideUserUtils.php.
References Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder().
const MediaWiki\Block\HideUserUtils::HIDDEN_USERS = 2 |
Select users that are hidden.
Definition at line 21 of file HideUserUtils.php.
const MediaWiki\Block\HideUserUtils::SHOWN_USERS = 1 |
Select users that are not hidden.
Definition at line 16 of file HideUserUtils.php.