Page MenuHomePhabricator

expose article count method through API
Open, LowPublic

Description

As far as I know, there is no way to determine the article count method ($wgArticleCountMethod = 'link' or 'any') of a particular wiki via the API. This should be changed.

Reasoning: The article count itself can be found through the API using an "siprop=statistics" query. Identifying the wiki's content namespaces can be done with an "siprop=namespaces" query. But in order to understand which pages will actually be counted as articles / content pages, one needs to know the wiki's article count method, which currently seems not to be available through the API.

Event Timeline

Dcljr created this task.Oct 4 2019, 7:56 PM
Restricted Application added a project: Core Platform Team. · View Herald TranscriptOct 4 2019, 7:56 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.
Anomie added a subscriber: Anomie.

Do you have an actual use case that requires this information, or is this a hypothetical request?

Dcljr added a comment.Oct 8 2019, 4:36 AM

The short answer is: any use case that requires knowing and understanding the article count of a wiki.

("Knowing" is covered by Special:Statistics, but "understanding" is an entirely different matter — which is what this task addresses. Just to state this explicitly, in case someone doesn't know: in order to understand what exactly is being counted to determine the article count [or "content page" count] of a wiki, one needs to know which of the wiki's namespaces contain content and which counting method is being used.)

If the reason you are asking is to determine whether there is another way of accomplishing the same thing I'm requesting, I will point out that, AFAIK, the only way (as a regular, non-sysadmin user) to determine the article-counting method of a Wikimedia wiki (if not other MediaWiki-based wikis) is to search for "ArticleCountMethod" in the publicly-accessible (but enormous) InitialiseSettings.php file.

Unfortunately, that way of finding information about a wiki is not always reliable because settings in that file can be overridden elsewhere, sometimes in ways that are "hidden" from public view. Also, the exact configuration variable(s) involved and where they are defined may change in the future (and, in fact, in this case it will change, assuming T223602 is resolved).

So we are left with a situation where there are at least three different ways of getting (as a regular user) the article count of a wiki on the wiki itself (Special:Statistics, {{NUMEROFARTICLES}}, and API query), at least one way of getting one additional piece of information necessary to interpret that number correctly (API query to determine the content namespaces), but no on-wiki way of getting the remaining necessary piece of information: the article count method the wiki is using.

If you consider that "hypothetical", then I guess it's hypothetical.

Oh, and I'll also point out that the "precipitating cause" of this task was T233069#5501946. If I am to avoid citing InitialiseSettings.php, then I need an alternate way of citing this configuration setting for specific wikis. Does this count as a "use case"?

Anomie added a comment.Oct 8 2019, 5:52 PM

If you consider that "hypothetical", then I guess it's hypothetical.

Yes, all that is hypothetical. An actual use case would be some specific code that you have (or want to write) that needs this information.

Oh, and I'll also point out that the "precipitating cause" of this task was T233069#5501946. If I am to avoid citing InitialiseSettings.php, then I need an alternate way of citing this configuration setting for specific wikis. Does this count as a "use case"?

You have two example statements in the description of that task. Neither seems to need an API query.

For "this is because this wiki has variable X set to value Y in InitialiseSettings.php", you'd be better served by linking to the file in the repository with a permanent link. For example, you might link to https://gerrit.wikimedia.org/r/plugins/gitiles/operations/mediawiki-config/+/a8413ee9f7facaede2a25798e5cc0101c85752ad/wmf-config/InitialiseSettings.php#14525 or https://github.com/wikimedia/operations-mediawiki-config/blob/a8413ee9f7facaede2a25798e5cc0101c85752ad/wmf-config/InitialiseSettings.php#L14525 to discuss the value now. Those links should continue to work even if future changes result in wgArticleCountMethod being set on a different line or in a different file.

For "to get this behavior, you need to request change C be made to InitialiseSettings.php", there's not much point in mentioning InitialiseSettings.php at all. You'd do better to link to https://meta.wikimedia.org/wiki/Requesting_wiki_configuration_changes instead.

CCicalese_WMF triaged this task as Low priority.Oct 8 2019, 6:07 PM
CCicalese_WMF moved this task from Triage Meeting Inbox to Icebox on the Core Platform Team board.