[Mediawiki-api-announce] Alternative for list=categorymembers&cmnamespace introduced in MediaWiki 1.18

Roan Kattouw roan.kattouw at gmail.com
Wed Oct 5 17:04:37 UTC 2011


With MediaWiki 1.18 now being deployed to WMF wikis (the final set of
wikis is slated to get 1.18 tonight starting at 23:00 UTC), I've heard
reports of people using list=categorymembers&cmnamespace=6 and getting
an empty result, even though there are files in the category. This is
a symptom of the cmnamespace workaround that was introduced about two
years ago.

However, we now have the cmtype parameter that can be used to replace
most uses of cmnamespace, and doesn't suffer from any of its flaws (no
nasty hacks to work around slow DB queries, no incomplete or empty
results):

To only list files, use &cmtype=file (previously &cmnamespace=6)
To only list subcategories, use &cmtype=subcat (previously &cmnamespace=14)
To only list 'normal' pages that aren't files or subcategories, use
&cmtype=page (previously
&cmnamespace=0|1|etc|everything|except|six|and|fourteen)
You can combine values for cmtype, e.g. &cmtype=file|subcat to list
both files and subcategories. The default value for cmtype is
file|subcat|page (i.e. list everything).

Roan



More information about the Mediawiki-api-announce mailing list