r89988 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89987‎ | r89988 | r89989 >
Date:18:18, 13 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed compat issue
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Math/SRF_Math.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Math/SRF_Math.php
@@ -29,17 +29,17 @@
3030 $max = '';
3131
3232 while ( $row = $res->getNext() ) {
33 - $last_col = array_pop( $row );
 33+ /* SMWResultArray */ $last_col = array_pop( $row );
3434
35 - foreach ( $last_col->getContent() as $value ) {
 35+ while ( ( $value = efSRFGetNextDV( $last_col ) ) !== false ) {
3636 // handle each value only if it's of type Number or NAry
3737 if ( $value instanceof SMWNumberValue ) {
38 - if ( method_exists( $value, 'getValueKey' ) ) {
 38+ // getDataItem was introduced in SMW 1.6, getValueKey was deprecated in the same version.
 39+ if ( method_exists( $value, 'getDataItem' ) ) {
 40+ $num = $value->getDataItem()->getNumber();
 41+ } else {
3942 $num = $value->getValueKey();
4043 }
41 - else {
42 - $num = $value->getNumericValue();
43 - }
4444 } elseif ( $value instanceof SMWNAryValue ) {
4545 $inner_values = $value->getDVs();
4646 // find the first inner value that's of
@@ -49,12 +49,12 @@
5050
5151 foreach ( $inner_values as $inner_value ) {
5252 if ( $inner_value instanceof SMWNumberValue ) {
53 - if ( method_exists( $inner_value, 'getValueKey' ) ) {
 53+ // getDataItem was introduced in SMW 1.6, getValueKey was deprecated in the same version.
 54+ if ( method_exists( $inner_value, 'getDataItem' ) ) {
 55+ $num = $inner_value->getDataItem()->getNumber();
 56+ } else {
5457 $num = $inner_value->getValueKey();
5558 }
56 - else {
57 - $num = $inner_value->getNumericValue();
58 - }
5959 break;
6060 }
6161 }