Руководство: Счетчик статей

This page is a translated version of the page Manual:Article count and the translation is 50% complete.

Количество статей - это количество страниц с контентом в вики. It is available from the wiki's Special:Statistics page, from the {{NUMBEROFARTICLES}} magic word, and through a "siteinfo " query via the MediaWiki API.

По умолчанию страница считается с контентом если:

  1. она находится в основном Пространстве имен (то есть заголовок не имеет префикса "Пользователь:" или "Обсуждение:"),
  2. содержит как минимум одну внутреннюю вики-ссылку (например текст "[[Main Page]]" создает вики-ссылку на страницу с названием "Main Page"), и
  3. эта страница не перенаправление.

Первый критерий можно расширить для других пространств имен при помощи переменной $wgContentNamespaces . (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

Изначально MediaWiki считала страницу статьей, если на ней была хотя бы одна запятая. Этот метод оказался ненадежным ввиду того, что в некоторых языках запятая не имела значения. (See Article count reform for the process which led to this outcome.)

До MediaWiki 1.18 метод подсчета статей определялся переменной в конфигурации $wgUseCommaCount , которая вскоре устарела и в конечном итоге была удалена в MediaWiki 1.24 .

Начиная с версии 1.18 используется переменная $wgArticleCountMethod

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

MW 1.18 and after

MW 1.17 and before

Версия MediaWiki:
1.17

Обновление статистики количества статей

После изменения метода подсчета вы наверняка захотите подсчитать статьи заново, чтобы посмотреть изменения (автоматически это не происходит). Для этого запустите updateArticleCount.php из командной строки.

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;

См. также