r23875 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23874‎ | r23875 | r23876 >
Date:18:05, 8 July 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Much more efficient redirect resolution queries.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php
@@ -885,10 +885,10 @@
886886 $from .= ' INNER JOIN ' . $db->tableName('smw_longstrings') . ' AS ' . $curtables['TEXT'] . ' ON ' . $curtables['TEXT'] . '.subject_id=' . $curtables['PAGE'] . '.page_id';
887887 return true;
888888 }
889 - } elseif ($tablename == 'REDIRECT') {
 889+ } elseif ($tablename == 'REDIRECT') {
890890 if ($this->addInnerJoin('PAGE', $from, $db, $curtables)) { // try to add PAGE
891891 $curtables['REDIRECT'] = 'rd' . $this->m_tablenum++;
892 - $from .= ' INNER JOIN ' . $db->tableName('redirect') . ' AS ' . $curtables['REDIRECT'] . ' ON ' . $curtables['REDIRECT'] . '.rd_from=' . $curtables['PAGE'] . '.page_id';
 892+ $from .= ' INNER JOIN ' . $db->tableName('redirect') . ' AS ' . $curtables['REDIRECT'];
893893 return true;
894894 }
895895 }
@@ -949,15 +949,13 @@
950950 $db->addQuotes($page->getDBKey()) . ' AND ' .
951951 $curtables['PREVREL'] . '.object_namespace=' .
952952 $page->getNamespace();
953 - if ( $smwgIQRedirectNormalization && ($this->addInnerJoin('PAGE', $from, $db, $curtables)) ) {
954 - $rdtable = 'rd' . $this->m_tablenum++;
955 - $from .= ' INNER JOIN ' . $db->tableName('redirect') . ' AS ' . $rdtable;
 953+ if ( $smwgIQRedirectNormalization && ($this->addInnerJoin('REDIRECT', $from, $db, $curtables)) ) {
956954 $cond = '(' . $cond . ') OR (' .
957 - $rdtable . '.rd_from=' .
 955+ $curtables['REDIRECT'] . '.rd_from=' .
958956 $curtables['PAGE'] . '.page_id AND ' .
959 - $rdtable . '.rd_title=' .
 957+ $curtables['REDIRECT'] . '.rd_title=' .
960958 $db->addQuotes($page->getDBKey()) . ' AND ' .
961 - $rdtable . '.rd_namespace=' .
 959+ $curtables['REDIRECT'] . '.rd_namespace=' .
962960 $page->getNamespace() . ')';
963961 }
964962 $where .= $cond;

Status & tagging log