r96866 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96865‎ | r96866 | r96867 >
Date:16:51, 12 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixes to array format
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Array/SRF_Array.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/RELEASE-NOTES (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/RELEASE-NOTES
@@ -6,6 +6,8 @@
77
88 * Fixed error in math printer when there are no numerical results.
99 * Fixed vCard compatibility with SMW 1.6 and later.
 10+* Fixed array compatibility with SMW 1.6 and later.
 11+* Added median and product formats to the list of default enabled formats.
1012
1113 == SRF 1.6.1 ==
1214
Index: trunk/extensions/SemanticResultFormats/Array/SRF_Array.php
@@ -143,7 +143,7 @@
144144 $missingProperty = true;
145145 } else
146146 //otherwise collect property value (potentially many values)
147 - foreach( $manyValues as $obj ) { // $manyValues of type SMWResultArray, contains many values (or just one) of one property of type SMWDataValue
 147+ while( $obj = efSRFGetNextDV( $field ) ) { // $manyValues of type SMWResultArray, contains many values (or just one) of one property of type SMWDataValue
148148
149149 $value_items = array();
150150
@@ -237,8 +237,11 @@
238238
239239 protected function createArray( $arr ) {
240240 global $wgArrayExtension;
241 - if( ! isset( $wgArrayExtension ) ) //Hash extension is not installed in this wiki
 241+
 242+ if( ! isset( $wgArrayExtension ) ) {
 243+ //Hash extension is not installed in this wiki
242244 return false;
 245+ }
243246
244247 $arrExtClass = new ReflectionClass( get_class( $wgArrayExtension ) );
245248
@@ -247,6 +250,7 @@
248251 } else {
249252 $wgArrayExtension->mArrayExtension[ $this->mArrayName ] = $arr; //dirty way
250253 }
 254+
251255 return true;
252256 }
253257
@@ -290,18 +294,24 @@
291295 }
292296 return parent::deliverQueryResultPages( $hash );
293297 }
 298+
294299 protected function createArray( $hash ) {
295300 global $wgHashTables;
296 - if( ! isset( $wgHashTables ) ) //Hash extension is not installed in this wiki
 301+
 302+ if( ! isset( $wgHashTables ) ) {
 303+ //Hash extension is not installed in this wiki
297304 return false;
298 -
 305+ }
 306+
299307 $hashExtClass = new ReflectionClass( get_class( $wgHashTables ) );
300308
301 - if( $hashExtClass->hasConstant( 'VERSION' ) && version_compare( $wgHashTables::VERSION, '0.6', '>=' ) ) {
302 - $wgHashTables->createHash( $this->mArrayName, $hash ); //requires Extension:HashTables 0.6 or higher
303 - } else {
304 - $wgHashTables->mHashTables[ $this->mArrayName ] = $hash; //dirty way
 309+ if ( $hashExtClass->hasConstant( 'VERSION' ) && version_compare( $wgHashTables::VERSION, '0.6', '>=' ) ) {
 310+ $wgHashTables->createHash( $this->mArrayName, $hash ); // requires Extension:HashTables 0.6 or higher
305311 }
 312+ else {
 313+ $wgHashTables->mHashTables[ $this->mArrayName ] = $hash;
 314+ }
 315+
306316 return true;
307317 }
308318