Extension:CategoryToolbox

Features

 * Discover if a certain page belongs to a certain category (also recursively!)
 * Discover the latest/oldest page added in a certain category

Manual
Note that the provided functions are expensive. See Manual:$wgExpensiveParserFunctionLimit.

The following documentation uses these terms:


 * : It means the category title eventually prefixed. E.g.  as well as just.
 * : It means the page title eventually prefixed. E.g..
 * : It means the namespace number. E.g..
 * : It means the recursion maximum depth. Accepted values are:
 * 0: no recursion (default)
 * -1: deep recursion (very expensive)
 * 1..n: choose your recursion limit (less expensive) [NOT YET IMPLEMENTED]

mw.ext.cattools.newestPage
Returns the page that is most recently added to the, eventually only from a certain.

It returns  or an object with some page informations. An example of result:

{ ns    = 6, title = 'Example.svg', date = '2017-10-28 23:59:59' }

mw.ext.cattools.oldestPage
Exactly as above, but about the less recently added page to the.

mw.ext.cattools.hasPage
Returns a boolean if the  belongs to the.

As default, there is no recursion, so the maximum  is assumed as.

mw.ext.cattools.havePages
If you don't specify  or if it's  : for each page provided in the   table, it checks if it belongs to every category, provided in the   table.

If you specify  as  : for each page provided in the   table, it checks if it belongs to at least one category, provided in the   table.

It returns table of booleans that is made by matching ' IDs. An example of result:

{ 123456: true }

Note that the  parameter is supported only in newer MediaWiki versions (see T179065). For older versions it's just assumed a deep recursion (very expensive).