Requests for comment/Parser function and tag tracking

From mediawiki.org
Request for comment (RFC)
Parser function and tag tracking
Component General
Creation date
Author(s) Legoktm, Jack Phoenix
Document status
See Phabricator.

We would like a standardized way to track the usage of parser functions and tags.

Background[edit]

In late 2008 Wikia introduced Special:TagsReport, a special page to show which pages use which parser tags (live example on Wookieepedia, the Star Wars wiki). Almost a decade later, Wikia is still using the TagsReport extension, and its update mechanism is still not open source; so while it's possible to take Wikia's GPL-licensed code and fix it enough that it will run on a vanilla MW 1.41, this will literally provide you with a special page that is never updated and thus it's not very useful.

From an editor's or an admin's point of view, the TagsReport special page is handy as it provides a quick overview of custom parser tags actually used on the wiki — Special:Version shows what custom extensions are installed, but it's perfectly possible that an extension is installed but never used. This way the wiki community and sysadmins are able to phase out unused extensions, as well as easily change and update callers (e.g. if a video embedding extension which provides the <coolvideoprovider> tag becomes unsupported and the wiki wants to move to a more standardized solution, such as Extension:YouTube or Extension:EmbedVideo, via the TagsReport special page editors are able to easily fetch a list of pages using the <coolvideoprovider> tag and edit those pages to use the new extension, after which the old one can be safely removed from the wiki's configuration).

Furthermore the TagsReport special page allows to keep an eye on potentially resource-intensive tags/extensions, such as DynamicPageList, and fix pages using those tags sooner than later.

Problem[edit]

There are currently two main ways to do this: tracking categories or page properties

Some other extensions can also be tracked via page properties because they set them for every invocation, such as TemplateData.

However there isn't a centralized overview of these, which hinders their discoverability and thus overall usefulness. Also as to what extension is using a tracking category and what is using a page property seems rather arbitrary and unnecessarily confusing.

Proposal[edit]

Automatically set a page property with the name of the function hook/tag when it is used (pf-$name, tag-name). Page properties are preferred because they're not directly exposed to readers, while a tracking category would require editors to manually hide it with __HIDDENCAT__.

Extensions could opt-out of tracking with a new Parser::SFH_NO_TRACKING if they are already providing a different way to find usage. And we would introduce a similar constant for tag hooks.

There are probably some improvements to Special:PagesWithProp that we should make around the same time, such as a namespace filter. We could also add a total counts view using a rollup table.