User:Austin J. Che/Extensions/Recentchangesfilter

From OpenWetWare

Jump to: navigation, search

The standard recent changes list can be overwhelming with the number of changes. An extension to MediaWiki to allow filtering the changes list using complex patterns is running on OpenWetWare.

For a quick start and demo, see Reshma Shetty/Recent changes for an example of using this page.

Contents

Usage

Currently, the only interface for using this extension is to create a URL by hand. The filtering criteria is passed in one of two ways. The short/easy way is to pass parameters at the end of the URL as extra path info as in http://openwetware.org/wiki/Special:Recentchanges/parameters. The second method is: http://openwetware.org/index.php?title=Special:Recentchanges&filter=parameters. Without any filter parameters, the page is identical to the normal changes list.

Once a URL is created, the appropriate page can be either bookmarked in your browser, linked from a wiki page, or directly included within another wiki page. When a filter is provided, an extra link is provided at the top that allows toggling between filtering and not filtering the changes list.

Selection Specification

The selection criteria is specified as a boolean statement in disjunctive normal form (groups of expressions ANDed together that are then all ORed together).

Expression

The general form for an expression is <match type>=<match pattern>.

Match types are 1 or 2 letter codes and specify how the match pattern should be used in selecting items to display in the recent changes list. The basic types and their meaning:

  • b: titles that begin with the pattern
  • e: titles that end with the pattern
  • c: titles that contain the pattern
  • m: titles that match where the match expression can contain any number of the '%' character to represent a wildcard character that matches any number of charaters. This is a more general version of the b, e, and c types.
  • n: The match pattern should be either a number corresponding to a namespace or the name of a namespace. This matches all pages that are in the given namespace. The main namespace has number 0 and doesn't have a name so you have to use the number. For other namespaces, you can use the name (e.g. 'User') or you can find the number by selecting the namespace in the dropdown list of the recent changes page, click go, and look at the URL to determine the namespace to number mapping.
  • u: match changes that were done by the given user
  • w: match changes for pages on your (or whoever's currently logged in) watchlist. The match pattern is ignored so it can just be set to 1 or left off completely.

All of the above types have a negated version with an extra n in front, i.e. nb, ne, nc, etc. For example, nb=foo will match all pages that don't begin with foo.

If no match type is specified (there is no equals sign), then the matching will be done with the default type of b.

Note that for the purpose of selecting pages by titles, it is necessary to be clear which namespace a page is in. For example, the page User:Austin is not a page titled User:Austin but rather a page titled Austin in the namespace User. Thus, b=User won't match this page but either b=Austin or n=User would. Pages like Knight:Contact are in the main namespace so b=Contact wouldn't match this whereas b=Knight would.

Joining Expressions

'^' is used to represent AND and ',' (comma) is used to represent OR. Expressions are assumed to be in disjunctive normal form so there's an intrinsic parenthesis order (and no way to change this order). This means that all the ANDs have higher precedence than the ORs.

Examples

Including within another page

The special page can be included using the standard {{Special:Recentchanges/parameters)}} syntax. This allows including a select list of changes on a page.

Source Download

The extension was written by Austin Che and is available for download: SpecialRecentchangesfilter.php


Feel free to send comments or improvements.

Personal tools