r56294 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56293‎ | r56294 | r56295 >
Date:08:29, 14 September 2009
Author:mkroetzsch
Status:deferred
Tags:
Comment:
more suitable handling of invalid page values in getSemanticData
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -116,15 +116,16 @@
117117 wfProfileIn("SMWSQLStore2::getSemanticData (SMW)");
118118 SMWSQLStore2::$in_getSemanticData++;
119119
120 - if ( $subject instanceof Title ) {
 120+ if ( $subject instanceof Title ) { ///TODO: can this still occur?
121121 $sid = $this->getSMWPageID($subject->getDBkey(),$subject->getNamespace(),$subject->getInterwiki());
122122 $svalue = SMWWikiPageValue::makePageFromTitle($subject);
123123 } elseif ($subject instanceof SMWWikiPageValue) {
124 - $sid = $this->getSMWPageID($subject->getDBkey(),$subject->getNamespace(),$subject->getInterwiki());
 124+ $sid = $subject->isValid()?
 125+ $this->getSMWPageID($subject->getDBkey(),$subject->getNamespace(),$subject->getInterwiki()):
 126+ 0;
125127 $svalue = $subject;
126128 } else {
127129 $sid = 0;
128 - $result = NULL;
129130 }
130131 if ($sid == 0) { // no data, safe our time
131132 /// NOTE: we consider redirects for getting $sid, so $sid == 0 also means "no redirects"

Status & tagging log