r38940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38939‎ | r38940 | r38941 >
Date:20:03, 8 August 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Minor fix in sortkey computation, fixed id handling of property redirects for certain exotic cases
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -692,7 +692,7 @@
693693 } else {
694694 $this->updateRedirects($subject->getDBKey(),$subject->getNamespace());
695695 }
696 - // always make an ID (pages without ID cannot be in qurey results, not even in fixed value queries!):
 696+ // always make an ID (pages without ID cannot be in query results, not even in fixed value queries!):
697697 $sid = $this->makeSMWPageID($subject->getDBkey(),$subject->getNamespace(),'',true,$subject->getSortkey());
698698 $db =& wfGetDB( DB_MASTER );
699699
@@ -1468,14 +1468,14 @@
14691469 $res = $db->select('smw_ids', array('smw_id', 'smw_iw', 'smw_sortkey'), 'smw_title=' . $db->addQuotes($title) . ' AND ' . 'smw_namespace=' . $db->addQuotes($namespace) . ' AND (smw_iw=' . $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWREDIIW) . ')', 'SMW::getSMWPageID', array('LIMIT'=>1));
14701470 if ($row = $db->fetchObject($res)) {
14711471 $sort = $row->smw_sortkey;
 1472+ $id = $row->smw_id; // set id in any case, the below check for properties will use even the redirect id in emergency
14721473 if ( ($row->smw_iw == '') || (!$canonical) || ($smwgQEqualitySupport == SMW_EQ_NONE) ) {
1473 - $id = $row->smw_id;
14741474 if ($row->smw_iw == '') {
14751475 $this->m_ids[$ckey] = $id; // what we found is also the canonical key, cache it
14761476 }
14771477 } else {
14781478 $redirect = true;
1479 - $this->m_ids[$nkey] = $row->smw_id; // what we found is the non-canonical key, cache it
 1479+ $this->m_ids[$nkey] = $id; // what we found is the non-canonical key, cache it
14801480 }
14811481 }
14821482 }
@@ -1514,7 +1514,7 @@
15151515 $id = $this->getSMWPageIDandSort($title, $namespace, $iw, $oldsort, $canonical);
15161516 if ($id == 0) {
15171517 $db =& wfGetDB( DB_MASTER );
1518 - $sortkey = $sortkey?$sortkey:$title;
 1518+ $sortkey = $sortkey?$sortkey:(str_replace('_',' ',$title));
15191519 $db->insert('smw_ids', array('smw_id' => 0, 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw, 'smw_sortkey' => $sortkey), 'SMW::makeSMWPageID');
15201520 $id = $db->insertId();
15211521 $this->m_ids["$iw $namespace $title -"] = $id; // fill that cache, even if canonical was given
@@ -1543,7 +1543,7 @@
15441544 $this->m_ids = array();
15451545 }
15461546 $this->m_ids[$nkey] = $id;
1547 - if ($real_iw == $iw) {
 1547+ if ($real_iw === $iw) {
15481548 $this->m_ids[$ckey] = $id;
15491549 }
15501550 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php
@@ -284,7 +284,7 @@
285285 */
286286 public function getSortkey() {
287287 $this->unstub();
288 - return $this->m_sortkey?$this->m_sortkey:$this->m_dbkeyform;
 288+ return $this->m_sortkey?$this->m_sortkey:(str_replace('_',' ',$this->m_dbkeyform));
289289 }
290290
291291 /**

Status & tagging log