手册:条目总数
The article count is the number of content pages on a wiki.
It is available from the wiki's Special:Statistics page, from the {{NUMBEROFARTICLES}}
magic word, and through a "siteinfo " query via the MediaWiki API.
By default, a page is counted as an article when:
- 它是在main命名空间(代表標題不包含"User:"或 "Talk:"前缀),
- it contains at least one internal wikilink (e.g. the text "[[Main Page]]" creates a wikilink to the page titled "Main Page"), and
- 頁面不是重定向。
The first criterion can be expanded to consider other namespaces through the use of the $wgContentNamespaces variable. (Note that some 扩展 do this when they are installed.)
The second criterion can be overridden if the $wgArticleCountMethod variable is set to the value "any", in which case all non-redirects in content namespaces are counted as articles. However, when the value "link" is used — which is the default as defined in DefaultSettings.php — only pages containing a wikilink are considered. This includes both stubs and disambiguation pages, provided they contain links.
There is no way to change the third criterion. Redirects are never counted as articles.
更改MediaWiki条目计数设置
在这个计数被使用之前,一个页面也会被计入只要它包含至少一个标点符号。 That method proved to be unreliable in many languages where the comma does not have much or any significance. (See Article count reform for the process which led to this outcome.)
Before MediaWiki 1.18 , the method used to count articles was determined by the configuration variable $wgUseCommaCount , which was at the same time deprecated and ultimately removed in MediaWiki 1.24 .
Since 1.18, the variable $wgArticleCountMethod has been used.
While article counting based on commas is still relatively common in the wiki world (see, e.g., MeatBall:BiggestWiki), the ability for MediaWiki to do this was completely removed in MediaWiki 1.31 .
In recent versions of MediaWiki, the existence of links is checked by consulting the pagelinks database table, so it includes links provided by the transclusion of templates or other pages. Special links such as category links (which place pages into categories) and file links (which display files) do not count when determining the article status of a page, because those links affect different database tables.
To change to a different method, use one of the following approaches:
MediaWiki版本: | ≥ 1.18 |
1.18或更新的版本
- Define the article count method with the variable $wgArticleCountMethod .
1.17或更旧的版本
MediaWiki版本: | ≤ 1.17 |
- If you want to count articles only if they contain a comma, you can set the variable $wgUseCommaCount to
true
in LocalSettings.php .
更新条目数量统计
如果你想重新对你的wiki计数来反应条目计数的方法(改变方法不会自动重新计数),在代码栏运行$updateArticleCount。
If you only have access to the database, you can get an approximation to the article count by using a query similar to the following, which only checks page links (similar to the "link" method) in the main namespace:
SELECT count(distinct(page_id))
FROM pagelinks
INNER JOIN page ON pl_from = page_id
WHERE page_namespace = 0
AND page_is_redirect = 0;