Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -38,6 +38,8 @@ |
39 | 39 | $query = $this->getQueryInfo(); |
40 | 40 | $query['fields'] = $this->getQueryFields(); |
41 | 41 | |
| 42 | + // TODO: Do we need to do the dates as Like? (bleugh) |
| 43 | + // Else, strtotime( '(First|Last) day of Month YYYY' ) |
42 | 44 | $db = $this->getDB(); |
43 | 45 | if ( $params['startmonth'] && !$params['endmonth'] ) { |
44 | 46 | $query['conds']['date'] = $params['startmonth']; |
— | — | @@ -90,6 +92,9 @@ |
91 | 93 | $query['conds']['country_code'] = $parsedFilter; |
92 | 94 | break; |
93 | 95 | case 'selectwebproperties': |
| 96 | + /*if ( $params['authcode'] != 'some string' ) { |
| 97 | + $this->dieUsage( 'Wrong code', 'badcode' ); |
| 98 | + }*/ |
94 | 99 | // c, d |
95 | 100 | // TODO: Cater for "top:20" etc |
96 | 101 | $query['conds']['web_property'] = $parsedFilter; |
— | — | @@ -143,6 +148,7 @@ |
144 | 149 | $result->addValue( 'metric', $this->getModuleName(), $data ); |
145 | 150 | } |
146 | 151 | |
| 152 | + // TODO: Deal with foo AS bar, and return bar for nicer aliasing of stuff |
147 | 153 | /** |
148 | 154 | * Looks to see if the column is fully qualified (table.column) |
149 | 155 | * If is, return only the column name |
— | — | @@ -261,7 +267,14 @@ |
262 | 268 | ), |
263 | 269 | ); |
264 | 270 | |
265 | | - return array_merge( $params, array_intersect_key( $select, array_flip( $this->getAllowedFilters() ) ) ); |
| 271 | + $params = array_merge( $params, array_intersect_key( $select, array_flip( $this->getAllowedFilters() ) ) ); |
| 272 | + |
| 273 | + if ( isset( $params['selectwebproperties'] ) ) { |
| 274 | + $params['authcode'] = array( |
| 275 | + ApiBase::PARAM_TYPE => 'string', |
| 276 | + ); |
| 277 | + } |
| 278 | + return $params; |
266 | 279 | } |
267 | 280 | |
268 | 281 | public function getParamDescription() { |
— | — | @@ -544,7 +557,7 @@ |
545 | 558 | ), |
546 | 559 | 'selectwebproperties' => array( |
547 | 560 | '', |
548 | | - 'This parameter requires extra authorisation', |
| 561 | + 'This parameter requires extra authorisation.', |
549 | 562 | ), |
550 | 563 | 'selectprojects' => array( |
551 | 564 | 'Which projects', |
— | — | @@ -562,6 +575,7 @@ |
563 | 576 | 'selecteditors' => 'a for anonymous, r for registered, b for bot', |
564 | 577 | 'selectedits' => 'm for manual, b for bot-induced', |
565 | 578 | 'selectplatform' => 'm for mobile, n for non-mobile', |
| 579 | + 'authcode' => "Auth code needed for 'selectwebproperties'", |
566 | 580 | ); |
567 | 581 | } |
568 | 582 | |