MediaWiki master
MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery Class Reference

Build and execute a query on the recentchanges table, optionally with joins and conditions. More...

Inherits MediaWiki\RecentChanges\ChangesListQuery\QueryBackend, and MediaWiki\RecentChanges\ChangesListQuery\JoinDependencyProvider.

Collaboration diagram for MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery:

Public Member Functions

 __construct (private ServiceOptions $config, private RecentChangeLookup $recentChangeLookup, private WatchedItemStoreInterface $watchedItemStore, private TempUserConfig $tempUserConfig, private UserFactory $userFactory, private LinkTargetLookup $linkTargetLookup, private ChangeTagsStore $changeTagsStore, private StatsFactory $statsFactory, private NameTableStore $slotRoleStore, private LoggerInterface $logger, private IReadableDatabase $db, private TableStatsProvider $rcStats,)
 
 addChangeTagSummaryField ()
 Add the change tag summary field ts_tags.
 
 addRedirectField ()
 Add the page_is_redirect field.
 
 adjustDensity ( $density)
 Adjust the density heuristic by multiplying it by the given factor.This sets the proportion of recentchanges rows likely to be matched by the conditions.
Parameters
float | int | string$densityEither a number or one of the self::DENSITY_* constants.
Returns
$this

 
 allowDeletedLogAction ()
 Override a previous call to excludeDeletedLogAction(), allowing deleted log rows to be shown.
 
 applyAction (string $verb, string $moduleName, $value=null)
 Apply an arbitrary action.
 
 audience (?Authority $authority)
 Set the Authority used for rc_deleted filters.
 
 caller (string $caller)
 Set the caller name to be passed down to the DBMS.
 
 commentFields ()
 Add CommentStore fields: rc_comment_text, rc_comment_data, rc_comment_cid.
 
 denseRcSizeThreshold ( $threshold)
 Set the minimum size of the recentchanges table at which change tag queries will be conditionally modified based on estimated density.
 
 distinct ()
 Flag that the joins will inadvertently duplicate recentchanges rows and that the query will have to deal with that somehow, maybe by adding a DISTINCT option.
Returns
$this

 
 enablePartitioning ()
 Enable query partitioning by timestamp, overriding the config.
 
 endAt (string $timestamp, ?int $id=null)
 Set the timestamp and ID for the end of the query results.
 
 excludeChangeTags ( $tagNames)
 Exclude changes matching any of the specified change tags.
 
 excludeDeletedLogAction ()
 Exclude rows relating to log entries that have the DELETED_ACTION bit set, unless the configured audience has permission to view such rows.
 
 excludeDeletedUser ()
 Exclude rows with the DELETED_USER bit set, unless the configured audience has permission to view such rows.
 
 excludeNamespaces (array $namespaces)
 Exclude namespaces by ID.
 
 excludeOldRevisions ()
 Exclude old revisions.
 
 excludeUser (UserIdentity $user)
 Exclude changes by a specific user.
 
 excludeWatchlistLabelIds (array $labelIds)
 Require that the changed page is not watched with one of the specified watchlist label IDs.
 
 fetchResult ()
 Execute the query and return the result.
 
 fields ( $fields)
 Add fields to the query.
 
 forceEmptySet ()
 Set a flag forcing the query to return no rows when it is executed.
 
 forcePartitioning ()
 Force partitioning, for testing.
 
 highlight (string $name, string $verb, string $moduleName, $value=null)
 Add a highlight to the query.
 
 isEmptySet ()
 Check whether forceEmptySet() has been called.
 
 joinForConds (string $table)
 Join on the specified table and declare that it will be used to provide fields for the WHERE clause.The table name must be registered in the ChangesListQuery. The join type can be set by calling a method on the returned object.
Parameters
string$table
Returns
ChangesListJoinBuilder

 
 joinForFields (string $table)
 Join on the specified table and declare that it will be used to provide fields for the SELECT clause.The table name must be registered in the ChangesListQuery. The join type can be set by calling a method on the returned object.
Parameters
string$table
Returns
ChangesListJoinBuilder

 
 joinOrderHint ( $order)
 
 legacyMutator (callable $callback)
 Add a callback which will be called when building an SQL query.
 
 limit (int $limit)
 Set the maximum number of rows to return.
 
 maxExecutionTime (float|int|null $time)
 Set the maximum query execution time in seconds, or null to disable the time limit.
 
 maybeAddWatchlistExpiryField ()
 Add the we_expiry field and its related join, if watchlist expiry is enabled.
 
 minTimestamp ( $timestamp)
 Set the minimum (earliest) rc_timestamp value.
 
 orderBy ( $sort)
 Set the sort order.
 
 rcUserFields ()
 Add the rc_user and rc_user_text fields to the query, conventional aliases for actor_user and actor_name.
Returns
$this

 
 recentChangeFields ()
 Add fields to the query sufficient for the subsequent construction of RecentChange objects from the returned rows.
 
 registerFilter ( $name, ChangesListCondition $module)
 
 requireChangeTags ( $tagNames)
 Require that the change has one of the specified change tags.
 
 requireLatest ()
 Require that the change is the latest change to the page.
 
 requireLink (string $direction, array $tables, PageIdentity $page)
 Require that the changed page links from or to the specified page, via the specified links tables.
 
 requireNamespaces (array $namespaces)
 Require namespaces by ID.
 
 requirePatrolled ( $value)
 Require a patrolled status.
 
 requireSlotChanged (string $role)
 Require that a specified slot role was modified.
 
 requireSources (array $sources)
 Require that the changes come from the specified sources, e.g.
 
 requireSubpageOf (LinkTarget|PageReference $page)
 Require that changed titles are subpages of a given page.
 
 requireTitle (LinkTarget|PageReference $title)
 Return only changes to a given page.
 
 requireUser (UserIdentity $user)
 Require changes by a specific user.
 
 requireWatched ( $watchTypes=[ 'watchedold', 'watchednew'])
 Require that the changed page is watched by the watchlist user specified in a call to watchlistUser().
 
 requireWatchlistLabelIds (array $labelIds)
 Require that the changed page is watched with one of the specified watchlist label IDs.
 
 sha1Fields ()
 Add the rev_deleted and rev_slot_pair fields, used by ApiQueryRecentChanges to deliver SHA-1 hashes for modified content.
 
 sortAndTruncate (array $inRows, ?int $limit, &$outRows)
 Sort rows by rc_timestamp/rc_id, remove any duplicates, and then truncate to the current query limit.
 
 sqbMutator (callable $callback)
 Add a callback which will be called with a SelectQueryBuilder during query construction.
 
 startAt (string $timestamp, ?int $id=null)
 Set the timestamp and ID for the start of the query results.
 
 watchlistFields ( $fields=[ 'wl_user', 'wl_notificationtimestamp', 'we_expiry'])
 Add watchlist fields to the query, and the relevant join.
 
 watchlistUser (UserIdentity $user)
 Set the user to be used for watchlist joins.
 
 where (IExpression $expr)
 Add a condition to the query.
 
- Public Member Functions inherited from MediaWiki\RecentChanges\ChangesListQuery\QueryBackend
 joinOrderHint (string $order)
 Set the join order hint.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 
const LINKS_FROM = 'from'
 
const LINKS_TO = 'to'
 
const PARTITION_THRESHOLD = 10000
 Minimum number of estimated rows before timestamp partitioning is considered.
 
const SORT_TIMESTAMP_ASC = 'timestamp-asc'
 
const SORT_TIMESTAMP_DESC = 'timestamp-desc'
 
- Public Attributes inherited from MediaWiki\RecentChanges\ChangesListQuery\QueryBackend
const DENSITY_CHANGE_TAG_THRESHOLD = 'change-tag-threshold'
 The minimum density to active change tag heuristics.
 
const DENSITY_LINKS = 'links'
 The naive density of a RecentChangesLinked query.
 
const DENSITY_USER = 'user'
 The naive density of a user/actor condition.
 
const DENSITY_WATCHLIST = 'watchlist'
 The naive density of a watchlist query.
 
const JOIN_ORDER_OTHER = 'other'
 Another table will likely be first in the join.
 
const JOIN_ORDER_RECENTCHANGES = 'recentchanges'
 The recentchanges table will likely be first in the join.
 

Detailed Description

Build and execute a query on the recentchanges table, optionally with joins and conditions.

Since
1.45

Definition at line 43 of file ChangesListQuery.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::__construct ( private ServiceOptions $config,
private RecentChangeLookup $recentChangeLookup,
private WatchedItemStoreInterface $watchedItemStore,
private TempUserConfig $tempUserConfig,
private UserFactory $userFactory,
private LinkTargetLookup $linkTargetLookup,
private ChangeTagsStore $changeTagsStore,
private StatsFactory $statsFactory,
private NameTableStore $slotRoleStore,
private LoggerInterface $logger,
private IReadableDatabase $db,
private TableStatsProvider $rcStats )

Member Function Documentation

◆ addChangeTagSummaryField()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::addChangeTagSummaryField ( )

Add the change tag summary field ts_tags.

Returns
$this

Definition at line 850 of file ChangesListQuery.php.

◆ addRedirectField()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::addRedirectField ( )

Add the page_is_redirect field.

Returns
$this

Definition at line 940 of file ChangesListQuery.php.

◆ adjustDensity()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::adjustDensity ( $density)

Adjust the density heuristic by multiplying it by the given factor.This sets the proportion of recentchanges rows likely to be matched by the conditions.

Parameters
float | int | string$densityEither a number or one of the self::DENSITY_* constants.
Returns
$this

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 689 of file ChangesListQuery.php.

◆ allowDeletedLogAction()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::allowDeletedLogAction ( )

Override a previous call to excludeDeletedLogAction(), allowing deleted log rows to be shown.

Returns
$this

Definition at line 549 of file ChangesListQuery.php.

◆ applyAction()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::applyAction ( string $verb,
string $moduleName,
$value = null )

Apply an arbitrary action.

This is used to implement filter definitions in ChangesListSpecialPage. Other callers should add/use a separate mutator method. The details of the module names and values are internal and unstable.

Note regarding implicit unions:

Conventionally, if you require two things of the same kind, like two namespaces, you will get results matching either condition. But if you require two different kinds of condition, like a namespace and a minor edit, you will only get results matching both conditions. In other words, filter modules implement an implicit union of required values.

However, exclusions intersect with requirements of the same kind, so if you require minor edits, and also exclude minor edits, you get no results.

This convention is flexible, consistent, and works well with the UI.

Access: internal
Parameters
string$verbMay be "require" or "exclude"
string$moduleNameThe name of the module, the thing to be required
mixed$valueAn optional value to pass to the module
Returns
$this

Definition at line 273 of file ChangesListQuery.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\modifyChangesListQuery().

◆ audience()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::audience ( ?Authority $authority)

Set the Authority used for rc_deleted filters.

Parameters
Authority | null$authority
Returns
$this

Definition at line 583 of file ChangesListQuery.php.

◆ caller()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::caller ( string $caller)

Set the caller name to be passed down to the DBMS.

Parameters
string$caller
Returns
$this

Definition at line 1599 of file ChangesListQuery.php.

◆ commentFields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::commentFields ( )

Add CommentStore fields: rc_comment_text, rc_comment_data, rc_comment_cid.

Note that recentChangeFields() also adds rc_comment_text and rc_comment_data, but for comment_id it uses the alias rc_comment_id. If you call both then you will get both aliases. But the joins will be deduplicated.

Returns
$this

Definition at line 955 of file ChangesListQuery.php.

◆ denseRcSizeThreshold()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::denseRcSizeThreshold ( $threshold)

Set the minimum size of the recentchanges table at which change tag queries will be conditionally modified based on estimated density.

Parameters
float | int$threshold
Returns
self

Definition at line 572 of file ChangesListQuery.php.

◆ distinct()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::distinct ( )

Flag that the joins will inadvertently duplicate recentchanges rows and that the query will have to deal with that somehow, maybe by adding a DISTINCT option.

Returns
$this

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 1622 of file ChangesListQuery.php.

◆ enablePartitioning()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::enablePartitioning ( )

Enable query partitioning by timestamp, overriding the config.

Returns
$this

Definition at line 748 of file ChangesListQuery.php.

Referenced by MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery\__construct().

◆ endAt()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::endAt ( string $timestamp,
?int $id = null )

Set the timestamp and ID for the end of the query results.

If the sort order is descending (the default) this is the minimum timestamp and ID. If the sort order is ascending, this is the maximum timestamp and ID. The ID, if specified, is used to break ties between results with equal timestamps.

Parameters
string$timestamp
int | null$id
Returns
$this

Definition at line 659 of file ChangesListQuery.php.

◆ excludeChangeTags()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeChangeTags ( $tagNames)

Exclude changes matching any of the specified change tags.

Parameters
string[]$tagNames
Returns
$this

Definition at line 465 of file ChangesListQuery.php.

◆ excludeDeletedLogAction()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeDeletedLogAction ( )

Exclude rows relating to log entries that have the DELETED_ACTION bit set, unless the configured audience has permission to view such rows.

Returns
$this

Definition at line 538 of file ChangesListQuery.php.

◆ excludeDeletedUser()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeDeletedUser ( )

Exclude rows with the DELETED_USER bit set, unless the configured audience has permission to view such rows.

Returns
$this

Definition at line 560 of file ChangesListQuery.php.

◆ excludeNamespaces()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeNamespaces ( array $namespaces)

Exclude namespaces by ID.

Parameters
int[]$namespaces
Returns
$this

Definition at line 305 of file ChangesListQuery.php.

◆ excludeOldRevisions()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeOldRevisions ( )

Exclude old revisions.

Latest revisions and changes that do not link to a revision, such as log entries, are allowed by this filter.

Returns
self

Definition at line 486 of file ChangesListQuery.php.

◆ excludeUser()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeUser ( UserIdentity $user)

Exclude changes by a specific user.

Parameters
UserIdentity$user
Returns
$this

Definition at line 433 of file ChangesListQuery.php.

◆ excludeWatchlistLabelIds()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::excludeWatchlistLabelIds ( array $labelIds)

Require that the changed page is not watched with one of the specified watchlist label IDs.

Since
1.46
Parameters
int[]$labelIds
Returns
$this

Definition at line 377 of file ChangesListQuery.php.

Referenced by MediaWiki\Specials\SpecialWatchlist\modifyQuery().

◆ fetchResult()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::fetchResult ( )

Execute the query and return the result.

Returns
ChangesListResult

Definition at line 1025 of file ChangesListQuery.php.

◆ fields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::fields ( $fields)

Add fields to the query.

Parameters
string | string[]$fields
Returns
$this

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 831 of file ChangesListQuery.php.

◆ forceEmptySet()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::forceEmptySet ( )

Set a flag forcing the query to return no rows when it is executed.

Like adding a 0=1 condition.

Returns
$this

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 716 of file ChangesListQuery.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroupContainer\modifyChangesListQuery(), MediaWiki\Specials\SpecialRecentChangesLinked\modifyQuery(), and MediaWiki\Specials\SpecialWatchlist\modifyQuery().

◆ forcePartitioning()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::forcePartitioning ( )

Force partitioning, for testing.

Returns
$this

Definition at line 758 of file ChangesListQuery.php.

◆ highlight()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::highlight ( string $name,
string $verb,
string $moduleName,
$value = null )

Add a highlight to the query.

A highlight is a client-side evaluation of a filter condition, given a caller-defined name. Results are available via ChangesListResult::getHighlightsFromRow().

If this is called more than once with the same name, the name will be available in the result if any of the actions matched.

This has no effect if it is called after the query is executed.

Access: internal
For ChangesListSpecialPage. The module names and values are internal and are subject to change.
Parameters
string$nameThe arbitrary highlight name
string$verbThe filter action verb, "require" or "exclude"
string$moduleNameThe module name, e.g. "bot"
mixed$valueAn optional value to pass to the filter module
Returns
$this

Definition at line 607 of file ChangesListQuery.php.

Referenced by MediaWiki\RecentChanges\ChangesListFilterGroup\modifyChangesListQuery().

◆ isEmptySet()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::isEmptySet ( )

Check whether forceEmptySet() has been called.

Note that the query may still return no rows even if this is false.

Returns
bool

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 727 of file ChangesListQuery.php.

◆ joinForConds()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::joinForConds ( string $table)

Join on the specified table and declare that it will be used to provide fields for the WHERE clause.The table name must be registered in the ChangesListQuery. The join type can be set by calling a method on the returned object.

Parameters
string$table
Returns
ChangesListJoinBuilder

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 1610 of file ChangesListQuery.php.

◆ joinForFields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::joinForFields ( string $table)

Join on the specified table and declare that it will be used to provide fields for the SELECT clause.The table name must be registered in the ChangesListQuery. The join type can be set by calling a method on the returned object.

Parameters
string$table
Returns
ChangesListJoinBuilder

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 1605 of file ChangesListQuery.php.

◆ joinOrderHint()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::joinOrderHint ( $order)

Definition at line 705 of file ChangesListQuery.php.

◆ legacyMutator()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::legacyMutator ( callable $callback)

Add a callback which will be called when building an SQL query.

It should have a signature like

function mutator( &$tables, &$fields, &$conds, &$options, &$join_conds )

See also
IReadableDatabase::select()

The mutator function may either return void, or it may return false to indicate that the forceEmptySet flag should be set.

This should not be used in new code.

Parameters
callable$callback
Returns
$this

Definition at line 996 of file ChangesListQuery.php.

◆ limit()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::limit ( int $limit)

Set the maximum number of rows to return.

Parameters
int$limit
Returns
$this

Definition at line 682 of file ChangesListQuery.php.

◆ maxExecutionTime()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::maxExecutionTime ( float|int|null $time)

Set the maximum query execution time in seconds, or null to disable the time limit.

Parameters
float | int | null$time
Returns
$this

Definition at line 738 of file ChangesListQuery.php.

◆ maybeAddWatchlistExpiryField()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::maybeAddWatchlistExpiryField ( )

Add the we_expiry field and its related join, if watchlist expiry is enabled.

Returns
$this

Definition at line 972 of file ChangesListQuery.php.

◆ minTimestamp()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::minTimestamp ( $timestamp)

Set the minimum (earliest) rc_timestamp value.

Parameters
string$timestampMW 14-char timestamp
Returns
$this

Definition at line 626 of file ChangesListQuery.php.

◆ orderBy()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::orderBy ( $sort)

Set the sort order.

Must be one of the SORT_xxx constants.

Parameters
string$sort
Returns
$this

Definition at line 671 of file ChangesListQuery.php.

◆ rcUserFields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::rcUserFields ( )

Add the rc_user and rc_user_text fields to the query, conventional aliases for actor_user and actor_name.

Returns
$this

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 838 of file ChangesListQuery.php.

◆ recentChangeFields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::recentChangeFields ( )

Add fields to the query sufficient for the subsequent construction of RecentChange objects from the returned rows.

Returns
$this

Definition at line 861 of file ChangesListQuery.php.

◆ registerFilter()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::registerFilter ( $name,
ChangesListCondition $module )
Access: internal
Parameters
string$name
ChangesListCondition$module

Definition at line 1632 of file ChangesListQuery.php.

◆ requireChangeTags()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireChangeTags ( $tagNames)

Require that the change has one of the specified change tags.

Parameters
string[]$tagNames
Returns
$this

Definition at line 455 of file ChangesListQuery.php.

◆ requireLatest()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireLatest ( )

Require that the change is the latest change to the page.

Changes that do not link to a page will not be shown.

Returns
$this

Definition at line 475 of file ChangesListQuery.php.

◆ requireLink()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireLink ( string $direction,
array $tables,
PageIdentity $page )

Require that the changed page links from or to the specified page, via the specified links tables.

Parameters
string$directionEither self::LINKS_FROM or self::LINKS_TO
string[]$tables
PageIdentity$page
Returns
$this

Definition at line 390 of file ChangesListQuery.php.

Referenced by MediaWiki\Specials\SpecialRecentChangesLinked\modifyQuery().

◆ requireNamespaces()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireNamespaces ( array $namespaces)

Require namespaces by ID.

Parameters
int[]$namespaces
Returns
$this

Definition at line 295 of file ChangesListQuery.php.

◆ requirePatrolled()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requirePatrolled ( $value)

Require a patrolled status.

Parameters
int$valueOne of the RecentChange::PRC_xxx constants
Returns
$this

Definition at line 444 of file ChangesListQuery.php.

◆ requireSlotChanged()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireSlotChanged ( string $role)

Require that a specified slot role was modified.

Parameters
string$role
Returns
$this

Definition at line 497 of file ChangesListQuery.php.

◆ requireSources()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireSources ( array $sources)

Require that the changes come from the specified sources, e.g.

RecentChange::SRC_EDIT

Parameters
array$sources
Returns
$this

Definition at line 412 of file ChangesListQuery.php.

◆ requireSubpageOf()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireSubpageOf ( LinkTarget|PageReference $page)

Require that changed titles are subpages of a given page.

Parameters
LinkTarget | PageReference$page
Returns
$this

Definition at line 330 of file ChangesListQuery.php.

◆ requireTitle()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireTitle ( LinkTarget|PageReference $title)

Return only changes to a given page.

Parameters
LinkTarget | PageReference$title
Returns
$this

Definition at line 341 of file ChangesListQuery.php.

◆ requireUser()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireUser ( UserIdentity $user)

Require changes by a specific user.

Parameters
UserIdentity$user
Returns
$this

Definition at line 422 of file ChangesListQuery.php.

◆ requireWatched()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireWatched ( $watchTypes = [ 'watchedold', 'watchednew' ])

Require that the changed page is watched by the watchlist user specified in a call to watchlistUser().

Parameters
string[]$watchTypes
Returns
$this

Definition at line 353 of file ChangesListQuery.php.

Referenced by MediaWiki\Specials\SpecialWatchlist\modifyQuery().

◆ requireWatchlistLabelIds()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::requireWatchlistLabelIds ( array $labelIds)

Require that the changed page is watched with one of the specified watchlist label IDs.

Since
1.46
Parameters
int[]$labelIds
Returns
$this

Definition at line 365 of file ChangesListQuery.php.

Referenced by MediaWiki\Specials\SpecialWatchlist\modifyQuery().

◆ sha1Fields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::sha1Fields ( )

Add the rev_deleted and rev_slot_pair fields, used by ApiQueryRecentChanges to deliver SHA-1 hashes for modified content.

Returns
self

Definition at line 901 of file ChangesListQuery.php.

◆ sortAndTruncate()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::sortAndTruncate ( array $inRows,
?int $limit,
& $outRows )

Sort rows by rc_timestamp/rc_id, remove any duplicates, and then truncate to the current query limit.

Access: internal
public for testing
Parameters
stdClass[]$inRows
int | null$limit
stdClass[]&$outRows

Definition at line 1405 of file ChangesListQuery.php.

◆ sqbMutator()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::sqbMutator ( callable $callback)

Add a callback which will be called with a SelectQueryBuilder during query construction.

It should have a signature like

function mutator( SelectQueryBuilder $queryBuilder ): void

The parameter may optionally be passed by reference and may be reassigned.

Instead consider integrating the functionality with this class.

Parameters
callable$callback
Returns
$this

Definition at line 1015 of file ChangesListQuery.php.

◆ startAt()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::startAt ( string $timestamp,
?int $id = null )

Set the timestamp and ID for the start of the query results.

If the sort order is descending (the default) this is the maximum timestamp and ID. If the sort order is ascending, this is the minimum timestamp and ID. The ID, if specified, is used to break ties between results with equal timestamps.

Parameters
string$timestamp
int | null$id
Returns
$this

Definition at line 642 of file ChangesListQuery.php.

◆ watchlistFields()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::watchlistFields ( $fields = [ 'wl_user', 'wl_notificationtimestamp', 'we_expiry' ])

Add watchlist fields to the query, and the relevant join.

If watchlist expiry is disabled, the we_expiry field will be omitted.

Parameters
string[]$fieldsThe fields to add
Returns
$this

Definition at line 877 of file ChangesListQuery.php.

Referenced by MediaWiki\Specials\SpecialRecentChanges\modifyQuery().

◆ watchlistUser()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::watchlistUser ( UserIdentity $user)

Set the user to be used for watchlist joins.

Parameters
UserIdentity$user
Returns
$this

Definition at line 817 of file ChangesListQuery.php.

◆ where()

MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::where ( IExpression $expr)

Add a condition to the query.

Parameters
IExpression$expr
Returns
$this

Implements MediaWiki\RecentChanges\ChangesListQuery\QueryBackend.

Definition at line 1588 of file ChangesListQuery.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::CONSTRUCTOR_OPTIONS
Initial value:
= [
...ExperienceCondition::CONSTRUCTOR_OPTIONS
]
const RCMaxAge
Name constant for the RCMaxAge setting, for use with Config::get()
const WatchlistExpiry
Name constant for the WatchlistExpiry setting, for use with Config::get()
const EnableChangesListQueryPartitioning
Name constant for the EnableChangesListQueryPartitioning setting, for use with Config::get()
const MiserMode
Name constant for the MiserMode setting, for use with Config::get()

Definition at line 44 of file ChangesListQuery.php.

◆ LINKS_FROM

const MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::LINKS_FROM = 'from'

Definition at line 52 of file ChangesListQuery.php.

◆ LINKS_TO

const MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::LINKS_TO = 'to'

Definition at line 53 of file ChangesListQuery.php.

◆ PARTITION_THRESHOLD

const MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::PARTITION_THRESHOLD = 10000

Minimum number of estimated rows before timestamp partitioning is considered.

Definition at line 63 of file ChangesListQuery.php.

◆ SORT_TIMESTAMP_ASC

const MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::SORT_TIMESTAMP_ASC = 'timestamp-asc'

Definition at line 66 of file ChangesListQuery.php.

◆ SORT_TIMESTAMP_DESC

const MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery::SORT_TIMESTAMP_DESC = 'timestamp-desc'

Definition at line 65 of file ChangesListQuery.php.


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