Index: trunk/extensions/MetricsReporting/MetricsReporting.php |
— | — | @@ -39,8 +39,8 @@ |
40 | 40 | $wgAutoloadClasses['DumpActiveEditors100Metric'] = $metricsDir . 'DumpActiveEditors100Metric.php'; |
41 | 41 | $wgMetricAPIModules['dumpactiveeditors100'] = 'DumpActiveEditors100Metric'; |
42 | 42 | |
43 | | -$wgAutoloadClasses['DumpActiveEditors15Metric'] = $metricsDir . 'DumpActiveEditors15Metric.php'; |
44 | | -$wgMetricAPIModules['dumpactiveeditors15'] = 'DumpActiveEditors15Metric'; |
| 43 | +$wgAutoloadClasses['DumpActiveEditors5Metric'] = $metricsDir . 'DumpActiveEditors5Metric.php'; |
| 44 | +$wgMetricAPIModules['dumpactiveeditors5'] = 'DumpActiveEditors5Metric'; |
45 | 45 | |
46 | 46 | $wgAutoloadClasses['DumpArticleCountMetric'] = $metricsDir . 'DumpArticleCountMetric.php'; |
47 | 47 | $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 |
1 | 42 | + native |