Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -27,6 +27,9 @@ |
28 | 28 | return $this->mDb; |
29 | 29 | } |
30 | 30 | |
| 31 | + public function execute() { |
| 32 | + } |
| 33 | + |
31 | 34 | /** |
32 | 35 | * @return array |
33 | 36 | */ |
Index: trunk/extensions/MetricsReporting/MetricsReporting.php |
— | — | @@ -12,6 +12,8 @@ |
13 | 13 | 'description' => 'Api for Wikimedia Metrics Reporting output', |
14 | 14 | ); |
15 | 15 | |
| 16 | +$wgMetricAPIModules = array(); |
| 17 | + |
16 | 18 | $wgMetricsDBserver = ''; |
17 | 19 | //$wgMetricsDBport = 5432; |
18 | 20 | $wgMetricsDBname = ''; |
— | — | @@ -25,3 +27,8 @@ |
26 | 28 | $wgAPIModules['analytics'] = 'ApiAnalytics'; |
27 | 29 | |
28 | 30 | $wgAutoloadClasses['ApiAnalyticsBase'] = $dir . 'ApiAnalyticsBase.php'; |
| 31 | + |
| 32 | +$metricsDir = $dir . 'metrics/'; |
| 33 | + |
| 34 | +$wgAutoloadClasses['ComScoreUniqueVisitorMetric'] = $metricsDir . 'ComScoreUniqueVisitorMetric.php'; |
| 35 | +$wgMetricAPIModules['comscoreuniquevisitors'] = 'ComScoreUniqueVisitorMetric'; |
Index: trunk/extensions/MetricsReporting/metrics/ComScoreUniqueVisitorMetric.php |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class ComScoreUniqueVisitorMetric extends ApiAnalyticsBase { |
| 5 | + |
| 6 | + public function getAllowedFilters() { |
| 7 | + return array( |
| 8 | + 'selectregions', |
| 9 | + 'selectcountries', |
| 10 | + ); |
| 11 | + } |
| 12 | + |
| 13 | + public function getDescription() { |
| 14 | + return 'Unique persons that visited one of the Wikimedia wikis at least once in a certain month'; |
| 15 | + } |
| 16 | + |
| 17 | + public function getVersion() { |
| 18 | + return __CLASS__ . ': $Id$'; |
| 19 | + } |
| 20 | +} |
Property changes on: trunk/extensions/MetricsReporting/metrics/ComScoreUniqueVisitorMetric.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 21 | + Id |
Added: svn:eol-style |
2 | 22 | + native |
Index: trunk/extensions/MetricsReporting/ApiAnalytics.php |
— | — | @@ -4,20 +4,19 @@ |
5 | 5 | |
6 | 6 | private $metricModuleNames, $params; |
7 | 7 | |
8 | | - private $metricModules = array( |
9 | | - ); |
10 | | - |
11 | 8 | public function __construct( $main, $action ) { |
12 | 9 | parent::__construct( $main, $action ); |
13 | | - $this->metricModuleNames = array_keys( $this->metricModules ); |
| 10 | + global $wgMetricAPIModules; |
| 11 | + $this->metricModuleNames = array_keys( $wgMetricAPIModules ); |
14 | 12 | } |
15 | 13 | |
16 | 14 | public function execute() { |
17 | 15 | $this->params = $this->extractRequestParams(); |
18 | 16 | |
| 17 | + global $wgMetricAPIModules; |
19 | 18 | // Instantiate requested modules |
20 | 19 | $modules = array(); |
21 | | - $this->instantiateModules( $modules, 'prop', $this->mQueryPropModules ); |
| 20 | + $this->instantiateModules( $modules, 'prop', $wgMetricAPIModules ); |
22 | 21 | |
23 | 22 | // Execute all requested modules. |
24 | 23 | foreach ( $modules as $module ) { |
— | — | @@ -42,10 +41,11 @@ |
43 | 42 | } |
44 | 43 | |
45 | 44 | public function getAllowedParams() { |
| 45 | + global $wgMetricAPIModules; |
46 | 46 | return array( |
47 | 47 | 'metric' => array( |
48 | 48 | ApiBase::PARAM_ISMULTI => false, |
49 | | - ApiBase::PARAM_TYPE => $this->metricModuleNames, |
| 49 | + ApiBase::PARAM_TYPE => $wgMetricAPIModules, |
50 | 50 | ApiBase::PARAM_REQUIRED => true, |
51 | 51 | ), |
52 | 52 | ); |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | * @return string |
84 | 84 | */ |
85 | 85 | public function makeHelpMsg() { |
86 | | - $msg = ''; |
| 86 | + $msg = parent::makeHelpMsg(); |
87 | 87 | |
88 | 88 | $querySeparator = str_repeat( '--- ', 12 ); |
89 | 89 | $moduleSeparator = str_repeat( '*** ', 14 ); |
— | — | @@ -90,11 +90,6 @@ |
91 | 91 | $msg .= $this->makeHelpMsgHelper( $this->metricModules, 'metric' ); |
92 | 92 | $msg .= "\n\n$moduleSeparator Modules: continuation $moduleSeparator\n\n"; |
93 | 93 | |
94 | | - // Perform the base call last because the $this->mAllowedGenerators |
95 | | - // will be updated inside makeHelpMsgHelper() |
96 | | - // Use parent to make default message for the query module |
97 | | - $msg = parent::makeHelpMsg() . $msg; |
98 | | - |
99 | 94 | return $msg; |
100 | 95 | } |
101 | 96 | |