r91125 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91124‎ | r91125 | r91126 >
Date:22:22, 29 June 2011
Author:reedy
Status:deferred
Tags:
Comment:
Fix name typo, add README for adding new metrics
Modified paths:
  • /trunk/extensions/MetricsReporting/MetricsReporting.php (modified) (history)
  • /trunk/extensions/MetricsReporting/README (added) (history)

Diff [purge]

Index: trunk/extensions/MetricsReporting/MetricsReporting.php
@@ -39,8 +39,8 @@
4040 $wgAutoloadClasses['DumpActiveEditors100Metric'] = $metricsDir . 'DumpActiveEditors100Metric.php';
4141 $wgMetricAPIModules['dumpactiveeditors100'] = 'DumpActiveEditors100Metric';
4242
43 -$wgAutoloadClasses['DumpActiveEditors15Metric'] = $metricsDir . 'DumpActiveEditors15Metric.php';
44 -$wgMetricAPIModules['dumpactiveeditors15'] = 'DumpActiveEditors15Metric';
 43+$wgAutoloadClasses['DumpActiveEditors5Metric'] = $metricsDir . 'DumpActiveEditors5Metric.php';
 44+$wgMetricAPIModules['dumpactiveeditors5'] = 'DumpActiveEditors5Metric';
4545
4646 $wgAutoloadClasses['DumpArticleCountMetric'] = $metricsDir . 'DumpArticleCountMetric.php';
4747 $wgMetricAPIModules['dumparticlecount'] = 'DumpArticleCountMetric';
Index: trunk/extensions/MetricsReporting/README
@@ -0,0 +1,40 @@
 2+
 3+== Adding new metrics ==
 4+
 5+Create a new file in the metrics folder with the name of your new metric, append "Metric" to the name.
 6+e.g. If your metric is BalloonsPerWikipedian, make the file BalloonsPerWikipedia.php, this will also be your class name
 7+
 8+svn propset svn:eol-style native BalloonsPerWikipedianMetric.php
 9+svn propset svn:keywords Id BalloonsPerWikipedianMetric.php
 10+
 11+File contents:
 12+<source lang="php">
 13+<?php
 14+
 15+class BalloonsPerWikipedianMetric extends ApiAnalyticsBase {
 16+
 17+ public function getAllowedFilters() {
 18+ return array(
 19+ 'selectregions',
 20+ 'selectcountries',
 21+ );
 22+ }
 23+
 24+ public function getDescription() {
 25+ return 'Wikipedians like balloons, right?';
 26+ }
 27+
 28+ public function getVersion() {
 29+ return __CLASS__ . ': $Id: $';
 30+ }
 31+}
 32+</source>
 33+
 34+Then to the bottom of MetricsReport.php, add:
 35+
 36+<source lang="php">
 37+$wgAutoloadClasses['CLASSNAME'] = $metricsDir . 'CLASSNAME.php';
 38+$wgMetricAPIModules['metricname'] = 'CLASSNAME';
 39+</source>
 40+
 41+CLASSNAME is BalloonsPerWikipedianMetric etc. For the "metricname", this is how it will be identified in the API.
Property changes on: trunk/extensions/MetricsReporting/README
___________________________________________________________________
Added: svn:eol-style
142 + native

Status & tagging log