r94998 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94997‎ | r94998 | r94999 >
Date:14:35, 19 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -307,16 +307,24 @@
308308
309309 return $result;
310310 } else { // result for counting or debugging is just a string
311 - if ( array_key_exists( 'intro', $params ) ) {
312 - $res = str_replace( '_', ' ', $params['intro'] ) . $res;
 311+ if ( is_string( $res ) ) {
 312+ if ( array_key_exists( 'intro', $params ) ) {
 313+ $res = str_replace( '_', ' ', $params['intro'] ) . $res;
 314+ }
 315+ if ( array_key_exists( 'outro', $params ) ) {
 316+ $res .= str_replace( '_', ' ', $params['outro'] );
 317+ }
 318+
 319+ $result = $res . smwfEncodeMessages( $query->getErrors() );
313320 }
314 - if ( array_key_exists( 'outro', $params ) ) {
315 - $res .= str_replace( '_', ' ', $params['outro'] );
 321+ else {
 322+ // When no valid result was obtained, $res will be a SMWQueryResult.
 323+ $result = smwfEncodeMessages( $query->getErrors() );
316324 }
317 -
 325+
318326 wfProfileOut( 'SMWQueryProcessor::getResultFromQuery (SMW)' );
319 -
320 - return $res . smwfEncodeMessages( $query->getErrors() );
 327+
 328+ return $result;
321329 }
322330 }
323331