r91612 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91611‎ | r91612 | r91613 >
Date:22:12, 6 July 2011
Author:nimishg
Status:deferred
Tags:
Comment:
handles case of no filters
Modified paths:
  • /trunk/extensions/MetricsReporting/ApiAnalyticsBase.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php
@@ -151,7 +151,7 @@
152152 $things = array();
153153 // Build result set
154154 foreach( $res as $row ) {
155 - if( !isset( $things[$row->$storageKey] ) ) { // find dynamic value for each query type
 155+ if( isset($storageKey) && !isset( $things[$row->$storageKey] ) ) { // find dynamic value for each query type
156156 $things[$row->$storageKey] = array();
157157 foreach( $titleFields as $field ) {
158158 $things[$row->$storageKey][$field] = $row->$field;
@@ -164,8 +164,13 @@
165165 $item[$field] = $row->$field;
166166 }
167167
168 - $things[$row->$storageKey]['data'][] = $item;
169 - $result->setIndexedTagName( $things[$row->$storageKey]['data'], 'd' );
 168+ if( isset( $storageKey ) ){
 169+ $things[$row->$storageKey]['data'][] = $item;
 170+
 171+ $result->setIndexedTagName( $things[$row->$storageKey]['data'], 'd' );
 172+ } else {
 173+ $result->addValue( array( $this->getModuleName() ), null, $item );
 174+ }
170175 }
171176
172177 // Add data to the output

Follow-up revisions

RevisionCommit summaryAuthorDate
r91614Followup r91612, be a bit more explicit with the codereedy22:18, 6 July 2011

Status & tagging log