Manual:Article count

From MediaWiki.org
(Redirected from Manual:Article)
Jump to: navigation, search
Translate this page; This page contains changes which are not marked for translation.

Other languages:
English • ‎français • ‎日本語 • ‎polski • ‎中文

{{NUMBEROFARTICLES}} is a Magic word that returns the number of articles (on this wiki it currently gives 37,193).

By default, a new page in the main namespace (the one without a prefix like "User:" or "Talk:") will be counted as an article in the statistics and the {{NUMBEROFARTICLES}} variable if it contains at least one wikilink (e.g. the text "[[Main Page]]" creates a wikilink to the page titled "Main Page") and is not a redirect.

Which namespaces are used can be controlled by $wgContentNamespacesManual:$wgContentNamespaces.

Before this count was used, an article was counted if it contained at least one comma.

That method proved to be unreliable in many languages where the comma does not have much or any significance (see m:Article count reform for the process which led to this outcome).

However, the comma count is still common in the wiki world; see, e.g., MeatBall:BiggestWiki.

Changing the MediaWiki article count settings[edit]

Before MediaWiki 1.18MediaWiki 1.18, the method used to count articles was determined by the configuration variable $wgUseCommaCountManual:$wgUseCommaCount which was at the same time deprecated and later removed in MediaWiki 1.24MediaWiki 1.24.

Since 1.18, the variable $wgArticleCountMethodManual:$wgArticleCountMethod is used.

In DefaultSettings.phpManual:Configuration settings, the default setting for $wgArticleCountMethodManual:$wgArticleCountMethod is "link", which means {{NUMBEROFARTICLES}} counts all pages in the main name namespace that are not a redirect and contain at least one wiki link.

This includes stubs containing a link, and disambiguation pages.

In recent versions of MediaWiki, the existence of links is checked by consulting the pagelinksManual:pagelinks table 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 version: 1.18

MW 1.18 and after[edit]

MW 1.17 and before[edit]

MediaWiki version: 1.17

Updating article count statistics[edit]

If you want to recount your statistics to reflect the change to comma-based "good article" count (that doesn't happen automatically), run updateArticleCount.phpManual:updateArticleCount.php from a command line.

If you only have access to the database you can get an approximation with a query similar to the following, which however only checks page links (similar to the "link" method):

SELECT count(distinct(page_id))
FROM pagelinks
INNER JOIN page ON pl_from = page_id
WHERE page_namespace = 0
AND page_is_redirect = 0;