Wikiscan

Wikiscan is a web-based tool that computes and displays historical statistics about a wiki site, originally for all Wikimedia Foundation (WMF) hosted wiki sites. Its About page states: "Wikiscan is not linked to the Wikimedia Foundation, the statistics published here are not official."

The Wikiscan application is standalone and written in PHP. It was created in 2011 on the initiative of a voluntary user for WMF wikis, and is located at https://wikiscan.org. Most of the software development was done on a voluntary basis. Although independent of the Wikimedia Foundation, Wikiscan was part subsidized by Wikimedia Foundation and the Wikimedia France chapter association, the latter of which is currently providing server hosting for Wikiscan.

The software code was originally available on the Wikiscan.org website for download. However, it is no longer available for download. In 2021, User:Ciencia Al Poder became interested in this tool for another wiki project, and was able to download a copy of the source code before it was removed; he documented some parts of it, and did a general review to fix some issues so it is able to work on independent wiki sites.

The Wikiscan tool generates statistics by querying public data from the wiki site's database, and stored on its own database. Data displayed on the tool is not updated in real time. The statistics data must be generated on a regular basis, using cron or similar.

Download
Wikiscan source code can be downloaded from GitHub, at: https://github.com/ciencia/wikiscan/

Requisites
This tool currently needs to be installed on it's own domain or subdomain. It does not support installing on a subdirectory other than the web root.
 * Webserver
 * PHP 5.5 or newer, tested on PHP 7.3
 * PHP modules : mbstring, curl, gd, mysqlnd, memcached
 * MySQL
 * It uses its own database and also needs access to the wiki's database
 * Memcached
 * Used for caching results

Installation

 * 1) Extract Wikiscan to a directory (example /var/www/wikiscan/)
 * 2) Create a new Mysql database (example wikiscan_stats)
 * 3) Import ctrl/stats.sql to create the tables.
 * 4) Create or configure a Mysql user with SELECT,INSERT,UPDATE,DELETE rights to the wikiscan database (example: wikiscan_user)
 * 5) Create or configure a Mysql user with SELECT rights to the wiki's database (it can be the same previously created user)
 * 6) Go to config/ directory
 * 7) Copy db_conf.sample.php to db_conf.php
 * 8) Edit db_conf.php
 * 9) Configure "db" with your Mediawiki database
 * 10) Configure "dbs" with the new stats database
 * 11) Copy local_conf.sample.php to local_conf.php
 * 12) Edit local_conf.php to configure local paths and wiki urls
 * 13) Make the directories wpstats/ cache/ and img/* writable

The site should work at this stage, but without any statistics yet.

Setting up rewrite rules
This tool generates some links that expect an existing set of rewrite rules for them to work.

apache
You can see code in the .htaccess file.

nginx
With alternate paths in Spanish:

Configuration parameters
Edit the conf/local_conf.php file, adding or updating keys of the $local_conf variable:

Multi wiki site
The Wikiscan tool was created originally for use on a single wiki site; it was subsequently expanded to serve all WMF wiki sites under the wikiscan.org domain. In the multi wiki setup option, each wiki site has its own Wikiscan database, along with an additional database containing data to coordinate all wiki sites. Under this multi wiki setup, this tool makes heavy use of undocumented and WMF-specific database views, and also it has connections with Wikidata.

This multi wiki behavior is controlled by the 'multi' configuration parameter, that defaults to false.

Supported languages
Currently supported interface languages:
 * English (en)
 * French / Français (fr)
 * Spanish / Español (es)

To add more languages, copy or add a file in include/languages/ with the desired ISO language code, translating from an existing one.

Known issues

 * It doesn't support wiki sites with a non-empty set (Bug #1).

Populating statistics for the first time
To update all daily stats and user stats, execute :

php ctrl/run.php fullupdate php ctrl/run.php fullupdate_months

To update last hours, execute :

php ctrl/run.php update_live

To update grid, execute :

php ctrl/run.php update_sum

Update statistics periodically
To update statistics regularly you can set up cron jobs to run several scripts:
 * ctrl/run.php update_live: Updates section hours and grid. Run it several times a day. It's fast.
 * ctrl/run.php update_sum: Updates calendar and users section. Run it at least once a day.
 * ctrl/run.php update_misc: Updates userstats graphs. Run it at least once a week.