r91202 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91201‎ | r91202 | r91203 >
Date:19:33, 30 June 2011
Author:reedy
Status:deferred
Tags:
Comment:
Fill out most of the filtering stuff I can easily match

Add sql query output
Modified paths:
  • /trunk/extensions/MetricsReporting/ApiAnalyticsBase.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php
@@ -38,6 +38,45 @@
3939 // months, normalized, data, reportlanguage
4040 // selectregions, selectcountries, selectwebproperties, selectprojects, selectwikis, selecteditors, selectedits, selectplatform
4141
 42+ $query['conds']['date'] = $params['months'];
 43+
 44+ if ( $params['normalised'] ) {
 45+ // Do data normalisation stuffs here
 46+ }
 47+ // if/switch on $params['data']
 48+
 49+ // $params['reportlanguage'] Change join based on select language
 50+
 51+ foreach( $this->getAllowedFilters() as $filter ) {
 52+ if ( isset( $params[$filter] ) ) {
 53+ switch ( $filter ) {
 54+ case 'selectregions':
 55+ $query['conds']['region_code'] = $params[$filter];
 56+ break;
 57+ case 'selectcountries':
 58+ $query['conds']['country_code'] = $params[$filter];
 59+ break;
 60+ case 'selectwebproperties':
 61+ $query['conds']['web_property'] = $params[$filter];
 62+ break;
 63+ case 'selectprojects':
 64+ $query['conds']['project_code'] = $params[$filter];
 65+ break;
 66+ case 'selectwikis':
 67+ $query['conds'][''] = $params[$filter];
 68+ break;
 69+ case 'selecteditors':
 70+ $query['conds'][''] = $params[$filter];
 71+ break;
 72+ case 'selectedits':
 73+ $query['conds'][''] = $params[$filter];
 74+ break;
 75+ case 'selectplatform':
 76+ $query['conds'][''] = $params[$filter];
 77+ break;
 78+ }
 79+ }
 80+ }
4281 $db = $this->getDB();
4382
4483 $this->profileDBIn();
@@ -45,9 +84,19 @@
4685 $this->profileDBOut();
4786
4887 $result = $this->getResult();
 88+ $data = array();
 89+
 90+ $fields = $this->getQueryFields();
4991 foreach( $res as $row ) {
 92+ $item = array();
 93+ foreach( $fields as $field ) {
 94+ $item[$field] = $row->$field;
 95+ }
 96+ $data[] = $item;
 97+ }
5098
51 - }
 99+ $result->setIndexedTagName( $data, 'metric' );
 100+ $result->addValue( 'quermetricy', $this->getModuleName(), $data );
52101 }
53102
54103 protected abstract function getQueryInfo();

Status & tagging log