Mailing List Archive

Patch: Daily + hourly stats
I've thrown together a pretty simple script to collect hourly + daily
stats on hits, edits, etc. It does a single simple query of the
site_stats table, so its load on the server is incredibly minimal.

The script calls out to ploticus to generate bar charts of daily and
hourly hits and edits on the wiki.

To use the script, gunzip this file into your /path/to/wiki/maintenance
directory, add something like the following to your crontab:
0 * * * * /usr/local/bin/php /home/nick/web/wiki/maintenance/stats.php
-hourly
0 0 * * * /usr/local/bin/php /home/nick/web/wiki/maintenance/stats.php
-daily

Then, modify '/path/to/wiki/includes/SpecialStatistics.php', and add
something like the following:

$wgOut->addHTML( "<hr />\n<image src=\"$wgScriptPath/images/sp" .
"ecial/hourly_stats.png\" alt=\"Hourly usage
statistics\" />\n" );

$wgOut->addHTML( "<hr />\n<image src=\"$wgScriptPath/images/sp" .
"ecial/daily_stats.png\" alt=\"Daily usage statistics\"
/>\n" );

I added these immediately after the first call to $wgOut->addWikiText(
$text ), on line 35 of my revision of the file.

I let the script run for a few days before modifying
SpecialStatistics.php, so that the daily table has enough data.

If someone with CVS commit privilege wants to add this to the default
install, go right ahead. BTW, I have only tested this against 1.3.2, I
haven't updated to a newer release yet.

Enjoy!
-Nick