Jump to content

Manual:Hooks/ChangesListSpecialPageQuery

From mediawiki.org
ChangesListSpecialPageQuery
Available from version 1.24.0
Called when building SQL query on pages inheriting from ChangesListSpecialPage (in core: RecentChanges, RecentChangesLinked and Watchlist).
Define function:
public static function onChangesListSpecialPageQuery( $name, &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ChangesListSpecialPageQuery": "MediaWiki\\Extension\\MyExtension\\Hooks::onChangesListSpecialPageQuery"
	}
}
Called from: File(s): ChangesListSpecialPage.php
Function(s): ChangesListSpecialPage::runMainQueryHook()
Interface: ChangesListSpecialPageQueryHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ChangesListSpecialPageQuery extensions.

Can be used to change the information with which the database query will be build to get the information for creating the contents of the special page.

Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure.

Instead, use sub-classes of those classes, in conjunction with the ChangesListSpecialPageStructuredFilters hook.

This hook can be used to implement filters that do not implement that structure, or custom behavior that is not an individual filter.

Details

[edit]
  • $name: name of the special page, e.g. 'Watchlist'
  • &$tables: array of tables to be queried
  • &$fields: array of columns to select
  • &$conds: array of WHERE conditionals for query
  • &$query_options: array of options for the database request
  • &$join_conds: join conditions for the tables
  • $opts: FormOptions for this request

Prior to MediaWiki 1.24, an equivalent hook was SpecialRecentChangesQuery.

See also

[edit]