Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -692,7 +692,7 @@ |
693 | 693 | } else { |
694 | 694 | $this->updateRedirects($subject->getDBKey(),$subject->getNamespace()); |
695 | 695 | } |
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!): |
697 | 697 | $sid = $this->makeSMWPageID($subject->getDBkey(),$subject->getNamespace(),'',true,$subject->getSortkey()); |
698 | 698 | $db =& wfGetDB( DB_MASTER ); |
699 | 699 | |
— | — | @@ -1468,14 +1468,14 @@ |
1469 | 1469 | $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)); |
1470 | 1470 | if ($row = $db->fetchObject($res)) { |
1471 | 1471 | $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 |
1472 | 1473 | if ( ($row->smw_iw == '') || (!$canonical) || ($smwgQEqualitySupport == SMW_EQ_NONE) ) { |
1473 | | - $id = $row->smw_id; |
1474 | 1474 | if ($row->smw_iw == '') { |
1475 | 1475 | $this->m_ids[$ckey] = $id; // what we found is also the canonical key, cache it |
1476 | 1476 | } |
1477 | 1477 | } else { |
1478 | 1478 | $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 |
1480 | 1480 | } |
1481 | 1481 | } |
1482 | 1482 | } |
— | — | @@ -1514,7 +1514,7 @@ |
1515 | 1515 | $id = $this->getSMWPageIDandSort($title, $namespace, $iw, $oldsort, $canonical); |
1516 | 1516 | if ($id == 0) { |
1517 | 1517 | $db =& wfGetDB( DB_MASTER ); |
1518 | | - $sortkey = $sortkey?$sortkey:$title; |
| 1518 | + $sortkey = $sortkey?$sortkey:(str_replace('_',' ',$title)); |
1519 | 1519 | $db->insert('smw_ids', array('smw_id' => 0, 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw, 'smw_sortkey' => $sortkey), 'SMW::makeSMWPageID'); |
1520 | 1520 | $id = $db->insertId(); |
1521 | 1521 | $this->m_ids["$iw $namespace $title -"] = $id; // fill that cache, even if canonical was given |
— | — | @@ -1543,7 +1543,7 @@ |
1544 | 1544 | $this->m_ids = array(); |
1545 | 1545 | } |
1546 | 1546 | $this->m_ids[$nkey] = $id; |
1547 | | - if ($real_iw == $iw) { |
| 1547 | + if ($real_iw === $iw) { |
1548 | 1548 | $this->m_ids[$ckey] = $id; |
1549 | 1549 | } |
1550 | 1550 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php |
— | — | @@ -284,7 +284,7 @@ |
285 | 285 | */ |
286 | 286 | public function getSortkey() { |
287 | 287 | $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)); |
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |