r97463 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97462‎ | r97463 | r97464 >
Date:10:47, 19 September 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
filter internal non-page elements from query results in the store
(largely fixes Bug 30969)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php
@@ -71,11 +71,6 @@
7272 * @param boolean $furtherRes
7373 */
7474 public function __construct( array $printRequests, SMWQuery $query, array $results, SMWStore $store, $furtherRes = false ) {
75 - // FIXME: this is a evil hack treating the symptom of something going wrong closer to the store
76 -// if ( count( $results ) > 0 && $results[0]->getInterwiki() === SMW_SQL2_SMWBORDERIW ) {
77 -// unset( $results[0] );
78 -// }
79 -
8075 $this->mResults = $results;
8176 reset( $this->mResults );
8277 $this->mPrintRequests = $printRequests;
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php
@@ -390,14 +390,16 @@
391391 $qobj->where, 'SMW::getQueryResult', $sql_options );
392392
393393 $qr = array();
394 - $count = 0;
 394+ $count = 0; // the number of fetched results ( != number of valid results in array $qr)
395395 $prs = $query->getDescription()->getPrintrequests();
396396
397397 while ( ( $count < $query->getLimit() ) && ( $row = $this->m_dbs->fetchObject( $res ) ) ) {
398398 $count++;
399 - $v = new SMWDIWikiPage( $row->t, $row->ns, $row->iw, $row->so );
400 - $qr[] = $v;
401 - $this->m_store->cacheSMWPageID( $row->id, $row->t, $row->ns, $row->iw, $row->so );
 399+ if ( $row->iw == '' || $row->iw{0} != ':' ) {
 400+ $v = new SMWDIWikiPage( $row->t, $row->ns, $row->iw, $row->so );
 401+ $qr[] = $v;
 402+ $this->m_store->cacheSMWPageID( $row->id, $row->t, $row->ns, $row->iw, $row->so );
 403+ }
402404 }
403405
404406 if ( $this->m_dbs->fetchObject( $res ) ) {