MediaWiki master
MediaWiki\RecentChanges\ChangesListFilterGroupContainer Class Reference

A container holding changes list filter groups. More...

Inherits IteratorAggregate.

Collaboration diagram for MediaWiki\RecentChanges\ChangesListFilterGroupContainer:

Public Member Functions

 addOptions (FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
 Add all the options represented by registered filter groups to $opts.
 
 addPendingConflict ( $sourceFilter, $conflictingGroupName, $conflictingFilterName, $opts)
 Register a conflict where the source exists but the destination doesn't exist yet.
 
 applyCssClassIfNeeded (IContextSource $ctx, RecentChange $rc, array &$classes)
 Add any necessary CSS classes.
 
 areFiltersInConflict (FormOptions $opts)
 Check if filters are in conflict and guaranteed to return no results.
 
 fillPriority (?int $priority)
 If a priority is passed, update the current auto-priority and return the passed value.
 
 fixContradictoryOptions (FormOptions $opts)
 Fix invalid options by resetting pairs that should never appear together.
 
 getGroup ( $name)
 Gets a specified ChangesListFilterGroup by name.
 
 getIterator ()
 Iterate over defined filter groups.
 
 getJsData ()
 Gets structured filter information needed by JS.
 
 getLegacyShowHideFilters ()
 Get the boolean filters which are displayed on the unstructured UI, with the filter name in the key.
 
 getSubpageParams ()
 Get the parameters which can be set via the subpage.
 
 hasGroup (string $name)
 Check if a group with a specific name is registered.
 
 modifyChangesListQuery (ChangesListQuery $query, FormOptions $opts, $isStructuredFiltersEnabled)
 Modifies the query according to the current filter groups.
 
 modifyLegacyQuery (IReadableDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
 Modifies the query according to the current filter groups.
 
 popPendingConflicts (ChangesListFilterGroup $group, ChangesListFilter $filter)
 Get any pending conflicts for the specified filter which is in the specified group, and remove the conflicts from the container.
 
 registerGroup (ChangesListFilterGroup $group)
 Register a structured changes list filter group.
 
 setDefaults (array $defaults)
 Apply a set of default overrides to the registered filters.
 
 toArray ()
 Get the filter groups as an associative array.
 

Detailed Description

A container holding changes list filter groups.

Helps ChangesListSpecialPage to iterate over all groups. Provides strongly typed accessors.

Access: internal

Definition at line 18 of file ChangesListFilterGroupContainer.php.

Member Function Documentation

◆ addOptions()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::addOptions ( FormOptions $opts,
$allowDefaults,
$isStructuredFiltersEnabled )

Add all the options represented by registered filter groups to $opts.

Parameters
FormOptions$opts
bool$allowDefaults
bool$isStructuredFiltersEnabled

Definition at line 205 of file ChangesListFilterGroupContainer.php.

◆ addPendingConflict()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::addPendingConflict ( $sourceFilter,
$conflictingGroupName,
$conflictingFilterName,
$opts )

Register a conflict where the source exists but the destination doesn't exist yet.

Parameters
ChangesListFilter$sourceFilter
string$conflictingGroupName
string$conflictingFilterName
array$opts

Definition at line 101 of file ChangesListFilterGroupContainer.php.

◆ applyCssClassIfNeeded()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::applyCssClassIfNeeded ( IContextSource $ctx,
RecentChange $rc,
array & $classes )

Add any necessary CSS classes.

Parameters
IContextSource$ctxContext source
RecentChange$rcRecent changes object
array&$classesNon-associative array of CSS class names; appended to if needed

Definition at line 386 of file ChangesListFilterGroupContainer.php.

References MediaWiki\RecentChanges\RecentChange\isHighlighted().

◆ areFiltersInConflict()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::areFiltersInConflict ( FormOptions $opts)

Check if filters are in conflict and guaranteed to return no results.

Returns
bool

Definition at line 167 of file ChangesListFilterGroupContainer.php.

References wfLogWarning().

◆ fillPriority()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::fillPriority ( ?int $priority)

If a priority is passed, update the current auto-priority and return the passed value.

If the priority is null, return the next auto-priority value.

Parameters
?int$priority
Returns
int

Definition at line 153 of file ChangesListFilterGroupContainer.php.

◆ fixContradictoryOptions()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::fixContradictoryOptions ( FormOptions $opts)

Fix invalid options by resetting pairs that should never appear together.

Parameters
FormOptions$opts
Returns
bool True if any option was reset

Definition at line 267 of file ChangesListFilterGroupContainer.php.

References MediaWiki\RecentChanges\ChangesListFilter\getName().

◆ getGroup()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::getGroup ( $name)

Gets a specified ChangesListFilterGroup by name.

Parameters
string$nameName of group
Returns
ChangesListFilterGroup|null Group, or null if not registered

Definition at line 69 of file ChangesListFilterGroupContainer.php.

◆ getIterator()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::getIterator ( )

Iterate over defined filter groups.

This is mostly for b/c with the FetchChangesList hook. When core needs to iterate over filter groups, there are usually specific wrapper functions.

Returns
ArrayIterator<ChangesListFilterGroup>

Definition at line 50 of file ChangesListFilterGroupContainer.php.

◆ getJsData()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::getJsData ( )

Gets structured filter information needed by JS.

Currently, this intentionally only includes filters that display in the structured UI. This can be changed easily, though, if we want to include data on filters that use the unstructured UI. messageKeys is a special top-level value, with the value being an array of the message keys to send to the client.

Returns
array Associative array
  • array $return['groups'] Group data
  • array $return['messageKeys'] Array of message keys

Definition at line 331 of file ChangesListFilterGroupContainer.php.

References MediaWiki\RecentChanges\ChangesListFilterGroup\getPriority().

◆ getLegacyShowHideFilters()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::getLegacyShowHideFilters ( )

Get the boolean filters which are displayed on the unstructured UI, with the filter name in the key.

Returns
array<string,ChangesListBooleanFilter>

Definition at line 304 of file ChangesListFilterGroupContainer.php.

◆ getSubpageParams()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::getSubpageParams ( )

Get the parameters which can be set via the subpage.

Returns
array<string,string> A map of the parameter name to its type, which can be either "bool" or "string".

Definition at line 363 of file ChangesListFilterGroupContainer.php.

◆ hasGroup()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::hasGroup ( string $name)

Check if a group with a specific name is registered.

Parameters
string$name
Returns
bool

Definition at line 79 of file ChangesListFilterGroupContainer.php.

◆ modifyChangesListQuery()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::modifyChangesListQuery ( ChangesListQuery $query,
FormOptions $opts,
$isStructuredFiltersEnabled )

Modifies the query according to the current filter groups.

The modification is only done if the filter group is in effect. This means that one or more valid and allowed filters were selected.

Parameters
ChangesListQuery$query
FormOptions$opts
bool$isStructuredFiltersEnabled

Definition at line 247 of file ChangesListFilterGroupContainer.php.

References MediaWiki\RecentChanges\ChangesListQuery\ChangesListQuery\forceEmptySet().

◆ modifyLegacyQuery()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::modifyLegacyQuery ( IReadableDatabase $dbr,
ChangesListSpecialPage $specialPage,
& $tables,
& $fields,
& $conds,
& $query_options,
& $join_conds,
FormOptions $opts,
$isStructuredFiltersEnabled )

Modifies the query according to the current filter groups.

The modification is only done if the filter group is in effect. This means that one or more valid and allowed filters were selected.

Parameters
IReadableDatabase$dbrDatabase, for addQuotes, makeList, and similar
ChangesListSpecialPage$specialPageCurrent special page
array&$tablesArray of tables; see IDatabase::select $table
array&$fieldsArray of fields; see IDatabase::select $vars
array&$condsArray of conditions; see IDatabase::select $conds
array&$query_optionsArray of query options; see IDatabase::select $options
array&$join_condsArray of join conditions; see IDatabase::select $join_conds
FormOptions$optsWrapper for the current request options and their defaults
bool$isStructuredFiltersEnabledTrue if the Structured UI is currently enabled

Definition at line 227 of file ChangesListFilterGroupContainer.php.

◆ popPendingConflicts()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::popPendingConflicts ( ChangesListFilterGroup $group,
ChangesListFilter $filter )

Get any pending conflicts for the specified filter which is in the specified group, and remove the conflicts from the container.

Parameters
ChangesListFilterGroup$group
ChangesListFilter$filter
Returns
iterable<array{0:ChangesListFilter,1:array}>

Definition at line 119 of file ChangesListFilterGroupContainer.php.

References MediaWiki\RecentChanges\ChangesListFilter\getName(), and MediaWiki\RecentChanges\ChangesListFilterGroup\getName().

◆ registerGroup()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::registerGroup ( ChangesListFilterGroup $group)

◆ setDefaults()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::setDefaults ( array $defaults)

Apply a set of default overrides to the registered filters.

Ignore any filters that don't exist.

Parameters
array<string,array<string,bool>|string>$defaults The key is the group name. For string options groups, the value is a string. For boolean groups, the value is an array mapping the filter name to the default value.

Definition at line 140 of file ChangesListFilterGroupContainer.php.

◆ toArray()

MediaWiki\RecentChanges\ChangesListFilterGroupContainer::toArray ( )

Get the filter groups as an associative array.

This can be removed when ChangesListSpecialPage::getFilterGroups() is removed.

Returns
ChangesListFilterGroup[]

Definition at line 59 of file ChangesListFilterGroupContainer.php.


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