Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | } |
54 | 54 | |
55 | 55 | // TODO: Data formatting |
56 | | - foreach( $params['data'] as $data ) { |
| 56 | + /*foreach( $params['data'] as $data ) { |
57 | 57 | switch ( $data ) { |
58 | 58 | case 'timeseries': |
59 | 59 | break; |
— | — | @@ -65,13 +65,15 @@ |
66 | 66 | case 'percentagegrowthfullperiod': |
67 | 67 | break; |
68 | 68 | } |
69 | | - } |
| 69 | + }*/ |
70 | 70 | //note: this means if you specify a report language that is not |
71 | 71 | //fully supported, you won't get a full data set back |
72 | 72 | if( $this->takesReportLanguage() ){ |
73 | 73 | $query['conds']['report_language'] = $params['reportlanguage']; |
74 | 74 | } |
75 | 75 | |
| 76 | + $titleFields = array(); |
| 77 | + |
76 | 78 | foreach( $this->getAllowedFilters() as $filter ) { |
77 | 79 | if ( !isset( $params[$filter] ) ) { |
78 | 80 | continue; |
— | — | @@ -86,11 +88,14 @@ |
87 | 89 | case 'selectregions': |
88 | 90 | // a, b, c |
89 | 91 | $query['conds']['comscore_regions.region_code'] = $parsedFilter; |
| 92 | + $titleFields[] = 'region_code'; |
| 93 | + $titleFields[] = 'region_name'; |
90 | 94 | break; |
91 | 95 | case 'selectcountries': |
92 | 96 | // b, c, d |
93 | 97 | // TODO: Cater for "top:20" etc |
94 | 98 | $query['conds']['country_code'] = $parsedFilter; |
| 99 | + $titleFields[] = ''; |
95 | 100 | break; |
96 | 101 | case 'selectwebproperties': |
97 | 102 | /*if ( $params['authcode'] != 'some string' ) { |
— | — | @@ -99,31 +104,37 @@ |
100 | 105 | // c, d |
101 | 106 | // TODO: Cater for "top:20" etc |
102 | 107 | $query['conds']['web_property'] = $parsedFilter; |
| 108 | + $titleFields[] = ''; |
103 | 109 | break; |
104 | 110 | case 'selectprojects': |
105 | 111 | // c |
106 | 112 | $query['conds']['project_code'] = $parsedFilter; |
| 113 | + $titleFields[] = ''; |
107 | 114 | break; |
108 | 115 | case 'selectwikis': |
109 | 116 | // c |
110 | 117 | // TODO: What's the format of the query need to be? |
111 | 118 | // ( lang = ltarget AND project = ptarget ) OR ( lang =ltarget2 AND project = ptarget2 ) |
112 | 119 | $query['conds'][''] = $parsedFilter; |
| 120 | + $titleFields[] = ''; |
113 | 121 | break; |
114 | 122 | case 'selecteditors': |
115 | 123 | // b, c |
116 | 124 | // TODO: Need where column |
117 | 125 | $query['conds'][''] = $parsedFilter; |
| 126 | + $titleFields[] = ''; |
118 | 127 | break; |
119 | 128 | case 'selectedits': |
120 | 129 | // b, c |
121 | 130 | // TODO: Need where column |
122 | 131 | $query['conds'][''] = $parsedFilter; |
| 132 | + $titleFields[] = ''; |
123 | 133 | break; |
124 | 134 | case 'selectplatform': |
125 | 135 | // b, c |
126 | 136 | // TODO: Need where column |
127 | 137 | $query['conds'][''] = $parsedFilter; |
| 138 | + $titleFields[] = ''; |
128 | 139 | break; |
129 | 140 | } |
130 | 141 | } |
— | — | @@ -141,12 +152,15 @@ |
142 | 153 | foreach( $res as $row ) { |
143 | 154 | // Dump all data to output |
144 | 155 | $item = array(); |
145 | | - foreach( array_diff( $fields, array( 'region_code', 'region_name' ) ) as $field ) { |
| 156 | + foreach( array_diff( $fields, $titleFields ) as $field ) { |
146 | 157 | $item[$field] = $row->$field; |
147 | 158 | } |
148 | 159 | |
149 | | - if( !isset( $things[$row->region_code] ) ) { |
150 | | - $things[$row->region_code] = array( 'region_code' => $row->region_code, 'region_name' => $row->region_name ); |
| 160 | + if( !isset( $things[$row->region_code] ) ) { // find dynamic value for each query type |
| 161 | + $things[$row->region_code] = array(); |
| 162 | + foreach( $titleFields as $field ) { |
| 163 | + $things[$row->region_code][$field] = $row->$field; |
| 164 | + } |
151 | 165 | } |
152 | 166 | |
153 | 167 | $things[$row->region_code]['data'][] = $item; |
— | — | @@ -157,9 +171,8 @@ |
158 | 172 | foreach( $things as $thing ) { |
159 | 173 | $result->addValue( array( $this->getModuleName() ), null, $thing ); |
160 | 174 | } |
161 | | - $result->setIndexedTagName_internal( array( $this->getModuleName() ), 'region' ); |
| 175 | + $result->setIndexedTagName_internal( array( $this->getModuleName() ), 'set' ); |
162 | 176 | |
163 | | - |
164 | 177 | } |
165 | 178 | |
166 | 179 | // TODO: Deal with foo AS bar, and return bar for nicer aliasing of stuff |
— | — | @@ -225,13 +238,6 @@ |
226 | 239 | } |
227 | 240 | |
228 | 241 | /** |
229 | | - * @return array |
230 | | - */ |
231 | | - public function getMetricFields() { |
232 | | - return array(); |
233 | | - } |
234 | | - |
235 | | - /** |
236 | 242 | * @return bool |
237 | 243 | */ |
238 | 244 | protected function takesReportLanguage(){ |
Index: trunk/extensions/MetricsReporting/metrics/DumpNewRegisteredEditorsMetric.php |
— | — | @@ -22,10 +22,6 @@ |
23 | 23 | return array( 'editors_new' ); |
24 | 24 | } |
25 | 25 | |
26 | | - public function getMetricFields() { |
27 | | - return array( 'editors_new' ); |
28 | | - } |
29 | | - |
30 | 26 | public function getDescription() { |
31 | 27 | return 'All registered editors that in a certain month for the first time crossed the threshold of 10 edits since signing up'; |
32 | 28 | } |
Index: trunk/extensions/MetricsReporting/metrics/ComScoreReachPercentageMetric.php |
— | — | @@ -27,10 +27,6 @@ |
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
31 | | - public function getMetricFields() { |
32 | | - return array( 'reach' ); |
33 | | - } |
34 | | - |
35 | 31 | public function getDescription() { |
36 | 32 | return 'Percentage of total unique visitors to any web property which also visited a Wikimedia Wiki'; |
37 | 33 | } |
Index: trunk/extensions/MetricsReporting/metrics/DumpEditsMetric.php |
— | — | @@ -22,10 +22,6 @@ |
23 | 23 | return array( 'edits' ); |
24 | 24 | } |
25 | 25 | |
26 | | - public function getMetricFields() { |
27 | | - return array( 'edits' ); |
28 | | - } |
29 | | - |
30 | 26 | public function getDescription() { |
31 | 27 | return 'All edits on articles (as defined by dumparticlecount)'; |
32 | 28 | } |
Index: trunk/extensions/MetricsReporting/metrics/EstimateOfflineMetric.php |
— | — | @@ -21,10 +21,6 @@ |
22 | 22 | ); |
23 | 23 | } |
24 | 24 | |
25 | | - public function getMetricFields() { |
26 | | - return array( 'readers' ); |
27 | | - } |
28 | | - |
29 | 25 | public function getDescription() { |
30 | 26 | return 'Estimated number of people whom access Wikipedia through an offline reader'; |
31 | 27 | } |
Index: trunk/extensions/MetricsReporting/metrics/DumpActiveEditors5Metric.php |
— | — | @@ -23,10 +23,6 @@ |
24 | 24 | return array( 'date', 'project_code', "SUM(editors_ge_{$this->numberOfActiveEditors})" ); |
25 | 25 | } |
26 | 26 | |
27 | | - public function getMetricFields() { |
28 | | - return array( "SUM(editors_ge_{$this->numberOfActiveEditors})" ); |
29 | | - } |
30 | | - |
31 | 27 | public function getDescription() { |
32 | 28 | return "All registered editors that made {$this->numberOfActiveEditors} or more edits in a certain month"; |
33 | 29 | } |
Index: trunk/extensions/MetricsReporting/metrics/SquidPageViewsMetric.php |
— | — | @@ -34,13 +34,6 @@ |
35 | 35 | return $this->queryFields; |
36 | 36 | } |
37 | 37 | |
38 | | - protected $metricField; |
39 | | - |
40 | | - public function getMetricFields() { |
41 | | - // , views_mobile_raw, views_non_mobile_normalized, views_mobile_normalized depending on normalized and select_platform |
42 | | - return $this->metricField; |
43 | | - } |
44 | | - |
45 | 38 | protected function canBeNormalised() { |
46 | 39 | return true; |
47 | 40 | } |
— | — | @@ -50,9 +43,9 @@ |
51 | 44 | // Swap page_views for page_views_v |
52 | 45 | |
53 | 46 | if ( $normalise ) { |
54 | | - $this->metricField = $this->queryFields = array( 'views_mobile_raw', 'views_non_mobile_raw' ); |
| 47 | + $this->queryFields = array( 'views_mobile_raw', 'views_non_mobile_raw' ); |
55 | 48 | } else { |
56 | | - $this->metricField = $this->queryFields = array( 'views_mobile_normalized', 'views_non_mobile_normalized' ); |
| 49 | + $this->queryFields = array( 'views_mobile_normalized', 'views_non_mobile_normalized' ); |
57 | 50 | } |
58 | 51 | } |
59 | 52 | |
Index: trunk/extensions/MetricsReporting/metrics/ComScoreUniqueVisitorMetric.php |
— | — | @@ -30,10 +30,6 @@ |
31 | 31 | return true; |
32 | 32 | } |
33 | 33 | |
34 | | - public function getMetricFields() { |
35 | | - return array( 'visitors' ); |
36 | | - } |
37 | | - |
38 | 34 | public function getDescription() { |
39 | 35 | return 'Unique persons that visited one of the Wikimedia wikis at least once in a certain month'; |
40 | 36 | } |
Index: trunk/extensions/MetricsReporting/metrics/DumpArticleCountMetric.php |
— | — | @@ -22,10 +22,6 @@ |
23 | 23 | return array( 'reach' ); |
24 | 24 | } |
25 | 25 | |
26 | | - public function getMetricFields() { |
27 | | - return array( 'reach' ); |
28 | | - } |
29 | | - |
30 | 26 | public function getDescription() { |
31 | 27 | return 'All namespace 0 pages which contain an internal link minus redirect pages (for some projects extra namespaces qualify)'; |
32 | 28 | } |
Index: trunk/extensions/MetricsReporting/metrics/DumpBinaryCountMetric.php |
— | — | @@ -22,10 +22,6 @@ |
23 | 23 | return array(); |
24 | 24 | } |
25 | 25 | |
26 | | - public function getMetricFields() { |
27 | | - return array( '' ); |
28 | | - } |
29 | | - |
30 | 26 | public function getDescription() { |
31 | 27 | return 'All binary files (nearly all of which are multimedia files) available for download/article inclusion on a wiki'; |
32 | 28 | } |