Расширение:HitCounters
![]() Статус релиза: стабильно |
|
---|---|
Реализация | База данных , Извлечение данных, MyWiki |
Описание | Предоставляет функциональность просмотров страницы |
Автор(ы) | Mark A. Hershberger (MarkAHershbergerобсуждение) |
Последняя версия | 0.3.4 |
MediaWiki | >= 1.36.0 |
PHP | 7.3.19+ |
Изменения в БД | Да |
Composer | mediawiki/hit-counters |
Таблицы | hit_counter hit_counter_extension |
Лицензия | GNU General Public License 3.0 или позднее |
Скачать | |
|
|
Ежеквартальные загрузки | 221 (Ranked 41st) |
Переведите расширение HitCounters, если оно доступно на translatewiki.net | |
Роль Vagrant | hitcounters |
Проблемы | Открытые задачи · Сообщить об ошибке |
Расширение HitCounters отображает количество просмотров в нижнем колонтитуле страницы и список самых просматриваемых страниц на служебной странице под названием PopularPages. Расширение предоставляет статистику просмотров страницы, которая была удалена в MediaWiki 1.25 .
Общие сведения
Преимущества
Расширение предоставляет редакторам обратную связь в виде измерения аудитории. Редакторы могут определять и улучшать популярные статьи, зная их примерный размер аудитории. Служебная страница HitCounters PopularPages также позволяет редакторам сосредоточить внимание на улучшение статей с наибольшей посещаемостью и помогает читателям узнавать наиболее курируемый контент проекта.
Расширение HitCounters включает определение wikiFactor — примерное определение популярности вики-сайта.
Расширение HitCounters минимально навязчивое с уважением к безопасности данных и опасениям по поводу конфиденциальности. The extension handles metrics on the server side so aggregated data stays within the site's security boundary. The extension does not inject JavaScript to be executed by the client, and does not ask a client to download additional un-audited code from a third party, like GoogleAnalyticsMetrics.
Расширение не следит за пользователями, посещающие страницу. As such, there's no need for special handling of Do Not Track browser requests or Global Privacy Control settings. The extension also does not use third party services, like GoogleAnalyticsMetrics.
Расширение не имеет зависимости, от которых могут возникнуть конфликты. Other extensions, like GoogleAnalyticsMetrics, can cause problems during a Composer update. Also see Phabricator P6481 .
Отличия от изначальной реализации MediaWiki
Before MediaWiki 1.25, the page views counting functionality was in core MediaWiki. This extension is based on that same code, but was deliberately done in a more lightweight way in order to speed up processing time. Many lines of superfluous code were removed. Also, the old MediaWiki core code did numerous database queries on every page hit; these have all been removed as well. This change may possibly lead to some inaccuracies in the data.
The core differences that wiki administrators need to know are:
- The hit counts are stored in cache.
- The visible hit count at the bottom of each page is updated only once per day. (Pages with hit count less than 100 are updated once per minute.)
- If you refresh your browser on a wiki page, that hit is ignored.
Что считается за просмотр
According to tests conducted by several MediaWiki operators, a view is counted if a page is accessed normally (action=view
), as well as action=render
and when accessing a page revision.
A view is not counted with the other actions, such as action=raw
, action=edit
, and action=info
.
Установка
Вы можете использовать composer для того, чтобы установить расширение, выполнив следующие две команды в вашей директории с MediaWiki:
$ COMPOSER=composer.local.json composer require --no-update mediawiki/hit-counters $ composer update
- Скачайте и распакуйте файл(ы) в папку с названием
HitCounters
в вашей папкеextensions/
. - Добавьте следующий код в конце вашего файла LocalSettings.php :
wfLoadExtension( 'HitCounters' );
- Выполните скрипт обновления, который автоматически создаст необходимые таблицы, используемые расширением.
- Configure as required.
Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.
Установка Vagrant:
- Если вы используете Vagrant , установите с помощью
vagrant roles enable hitcounters --provision
Migration from before MediaWiki 1.25
Another way to not lose page HitCounts while upgrading to newer version is by running SQL files from this extension manually (Tested by upgrading MW version from 1.23.0 to 1.35.9). Before upgrading entire MediaWiki database it is neccesary to install this extension and after this open folder with SQL files for this extension (should be path -> extensions/HitCounters/sql)
After that is following this approach:
- open file
rename_table.sql
. Delete it's content and replace it with this line ->CREATE TABLE hit_counter_extension SELECT * FROM hitcounter;
so instead of renaming table we are creating new one - run these 3 sql files on your MediaWiki database in this order: "rename_table.sql", "page_counter.sql" and "initial_count.sql"
- meaning your CLI command should look something like this:
mysql -p -u <db_user> -D my_wiki < <sql_file>.sql
- by running these 3 commands you will preserve Hit Counts on your pages
mysql -p -u <db_user> -D my_wiki < rename_table.sql
(edited one)
mysql -p -u <db_user> -D my_wiki < page_counter.sql
mysql -p -u <db_user> -D my_wiki < initial_count.sql
If you install this extension a new wiki, you do not have to care about migrating as described here. However if you run a MediaWiki with version earlier than 1.25.x and update to 1.26+, you have to prevent loss of your hitcounter numbers by migrating it carefully.
If you want to update MediaWiki to version 1.26, currently the following steps have to be done in order to prevent loss of hitcounter numbers:
- Use MediaWiki 1.25 and install this extension.
- Still in MediaWiki 1.25, run
update.php
. This step is mandatory! This should migrate the hitcounter data to the new locations:- Table
hit_counter
should exist and should contain all the hit numbers - Table
hit_counter_extension
should exist (and possibly contain information on the few, newest hits) - Note that I have not tested if this actually works!
The SQL files, which are included with the HitCounters extension, demonstrate the SQL commands, which have to be run before(!) runningupdate.php
in MediaWiki 1.26, in order to preserve the existing data. - Note: HitCounters in Version 0.3 does not work with MediaWiki 1.25. You may try a fork of HitCounters since Version 0.3.2.
- Table
- After the above steps, update to MediaWiki 1.26 or newer. Running
update.php
in that version will still remove hitcounter data from the old locations, as far as it is still present there. However, since you have done the migration, the extension should continue working!
Настройка
- $wgDisableCounters
- When set to
true
, it disables the notice in the pages footer saying "К этой странице обращались 256 раз." as well as the special pagePopularPages
. This configuration parameter was removed with MediaWiki 1.35.0.
- When set to
- $wgHitcounterUpdateFreq
- Sets how often page counters should be updated. Default value is
1
.
- Sets how often page counters should be updated. Default value is
Fork
There is a fork of this extension with extended backward compatibility available:
- Version 0.4.0 of this extension's fork is backward compatible to MediaWiki 1.25+.
- Version 0.3.2 of this extension's fork is backward compatible to MediaWiki 1.25+.
See also
- Extension:GoogleAnalyticsMetrics - Provides site-wide metrics for Google Analytics users
![]() | Это расширение включено в следующие вики-фермы/хостинги и/или пакеты: Это не исчерпывающий список. Некоторые вики-фермы/хостинги и/или пакеты могут содержать это расширение, даже если они не перечислены здесь. Всегда сверяйтесь со своими вики-фермами/хостингами или комплектами/бандлами для подтверждения. |
- Stable extensions/ru
- Database extensions/ru
- Data extraction extensions/ru
- Personalization extensions/ru
- Extensions supporting Composer/ru
- GPL licensed extensions/ru
- Extensions in Wikimedia version control/ru
- AbuseFilter-builder extensions/ru
- AbuseFilter-computeVariable extensions/ru
- AbuseFilter-deprecatedVariables extensions/ru
- AbuseFilter-generateTitleVars extensions/ru
- LoadExtensionSchemaUpdates extensions/ru
- MagicWordwgVariableIDs extensions/ru
- PageViewUpdates extensions/ru
- ParserFirstCallInit extensions/ru
- ParserGetVariableValueSwitch extensions/ru
- SkinAddFooterLinks extensions/ru
- SpecialStatsAddExtra extensions/ru
- All extensions/ru
- Extensions included in BlueSpice/ru
- Extensions included in MyWikis/ru
- Extensions included in WikiForge/ru
- Extensions included in WikiTide/ru
- Statistics extensions/ru
- Special page extensions/ru