r91217 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91216‎ | r91217 | r91218 >
Date:20:23, 30 June 2011
Author:reedy
Status:deferred
Tags:
Comment:
Needs some field munging due to ambiguous selects
Modified paths:
  • /trunk/extensions/MetricsReporting/ApiAnalyticsBase.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php
@@ -86,11 +86,11 @@
8787 $result = $this->getResult();
8888 $data = array();
8989
90 - $fields = $this->getQueryFields();
 90+ $fields = array_map( array( $this, 'getColumnName' ), $query['fields'] );
9191 foreach( $res as $row ) {
9292 $item = array();
9393 foreach( $fields as $field ) {
94 - $item[$field] = $row->$$field;
 94+ $item[$field] = $row->$field;
9595 }
9696 $data[] = $item;
9797 }
@@ -99,6 +99,15 @@
100100 $result->addValue( 'metric', $this->getModuleName(), $data );
101101 }
102102
 103+ private function getColumnName( $col ) {
 104+ $pos = strpos( $col, '.' );
 105+
 106+ if ( !$pos ) {
 107+ return $col;
 108+ }
 109+ return substr( $col, $pos + 1 );
 110+ }
 111+
103112 protected abstract function getQueryInfo();
104113
105114 protected abstract function getQueryFields();

Follow-up revisions

RevisionCommit summaryAuthorDate
r91218MFT r91118-r91217 for special/SpecialBannerLoader.php and special/SpecialBann...awjrichards20:31, 30 June 2011

Status & tagging log