MediaWiki master
MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition Class Reference

Inherits MediaWiki\RecentChanges\ChangesListQuery\ChangesListConditionBase.

Collaboration diagram for MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition:

Public Member Functions

 __construct (private ChangeTagsStore $changeTagsStore, private TableStatsProvider $rcStats, private LoggerInterface $logger, private bool $miserMode,)
 
 evaluate (stdClass $row, $value)
 Evaluate the filter condition against a row, determining whether it is true or false.Ignore the values set with require() and exclude(), use only the value passed as a parameter.To ensure that $row has the required fields present, capture() must be called before evaluate(). This will signal to prepareQuery() that the fields should be added.
Parameters
stdClass$row
mixed$valueThe validated value
Returns
bool

 
 setDenseRcSizeThreshold ( $threshold)
 Set the minimum size of the recentchanges table at which change tag queries will be conditionally modified based on estimated density.
 
 setDensityThresholdReached (bool $reached)
 
 setLimit (int $limit)
 Set the query limit to be used for density heuristics.
 
 validateValue ( $value)
 Validate a value and return its normalized form.
Parameters
mixed$value
Returns
mixed

 
- Public Member Functions inherited from MediaWiki\RecentChanges\ChangesListQuery\ChangesListConditionBase
 capture ()
 Set a flag indicating that evaluate() will be called with rows from the query result.
 
 isCaptured ()
 Check whether capture() has been called.
Returns
bool

 
- Public Member Functions inherited from MediaWiki\RecentChanges\ChangesListQuery\ChangesListCondition
 exclude ( $value)
 Add a value to the set of excluded values.
 
 prepareQuery (IReadableDatabase $dbr, QueryBackend $query)
 Add conditions and joins to the query in order to implement require() and exclude().
 

Protected Member Functions

 isDenseTagFilter (IReadableDatabase $dbr, array $tagIds)
 Determine whether a tag filter matches a high proportion of the rows in recentchanges.
 
 prepareCapture (IReadableDatabase $dbr, QueryBackend $query)
 
 prepareConds (IReadableDatabase $dbr, QueryBackend $query)
 Add conditions to the query according to the values passed to require() and exclude().Subclasses may use getUniqueValuesWithUnion() to get the required and excluded values.
Parameters
IReadableDatabase$dbr
QueryBackend$query

 

Additional Inherited Members

- Public Attributes inherited from MediaWiki\RecentChanges\ChangesListQuery\ChangesListConditionBase
 function
 
- Public Attributes inherited from MediaWiki\RecentChanges\ChangesListQuery\ChangesListCondition
 function
 Add a value to the set of required values.
 
- Protected Attributes inherited from MediaWiki\RecentChanges\ChangesListQuery\ChangesListConditionBase
array $excluded = []
 
array $required = []
 

Detailed Description

Definition at line 10 of file ChangeTagsCondition.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::__construct ( private ChangeTagsStore $changeTagsStore,
private TableStatsProvider $rcStats,
private LoggerInterface $logger,
private bool $miserMode )

Definition at line 16 of file ChangeTagsCondition.php.

Member Function Documentation

◆ evaluate()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::evaluate ( stdClass $row,
$value )

Evaluate the filter condition against a row, determining whether it is true or false.Ignore the values set with require() and exclude(), use only the value passed as a parameter.To ensure that $row has the required fields present, capture() must be called before evaluate(). This will signal to prepareQuery() that the fields should be added.

Parameters
stdClass$row
mixed$valueThe validated value
Returns
bool

Implements MediaWiki\RecentChanges\ChangesListQuery\ChangesListCondition.

Definition at line 60 of file ChangeTagsCondition.php.

◆ isDenseTagFilter()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::isDenseTagFilter ( IReadableDatabase $dbr,
array $tagIds )
protected

Determine whether a tag filter matches a high proportion of the rows in recentchanges.

If so, it is more efficient to scan recentchanges, filtering out non-matching rows, rather than scanning change_tag and then filesorting on rc_timestamp. MySQL is especially bad at making this judgement (T298225).

Parameters
IReadableDatabase$dbr
int[]$tagIds
Returns
bool

Definition at line 124 of file ChangeTagsCondition.php.

References Wikimedia\Rdbms\IReadableDatabase\expr(), Wikimedia\Rdbms\IReadableDatabase\getType(), and Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder().

◆ prepareCapture()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::prepareCapture ( IReadableDatabase $dbr,
QueryBackend $query )
protected

◆ prepareConds()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::prepareConds ( IReadableDatabase $dbr,
QueryBackend $query )
protected

Add conditions to the query according to the values passed to require() and exclude().Subclasses may use getUniqueValuesWithUnion() to get the required and excluded values.

Parameters
IReadableDatabase$dbr
QueryBackend$query

Reimplemented from MediaWiki\RecentChanges\ChangesListQuery\ChangesListConditionBase.

Definition at line 75 of file ChangeTagsCondition.php.

References MediaWiki\RecentChanges\ChangesListQuery\QueryBackend\distinct(), Wikimedia\Rdbms\IReadableDatabase\expr(), MediaWiki\RecentChanges\ChangesListQuery\QueryBackend\forceEmptySet(), MediaWiki\RecentChanges\ChangesListQuery\QueryBackend\joinForConds(), and MediaWiki\RecentChanges\ChangesListQuery\QueryBackend\where().

◆ setDenseRcSizeThreshold()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::setDenseRcSizeThreshold ( $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

Definition at line 47 of file ChangeTagsCondition.php.

◆ setDensityThresholdReached()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::setDensityThresholdReached ( bool $reached)
Parameters
bool$reachedWhether the query density is high enough to apply heuristics for a straight join

Definition at line 37 of file ChangeTagsCondition.php.

◆ setLimit()

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

Set the query limit to be used for density heuristics.

Parameters
int$limit

Definition at line 29 of file ChangeTagsCondition.php.

◆ validateValue()

MediaWiki\RecentChanges\ChangesListQuery\ChangeTagsCondition::validateValue ( $value)

Validate a value and return its normalized form.

Parameters
mixed$value
Returns
mixed

Implements MediaWiki\RecentChanges\ChangesListQuery\ChangesListCondition.

Definition at line 52 of file ChangeTagsCondition.php.


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