r17081 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17080‎ | r17081 | r17082 >
Date:08:42, 18 October 2006
Author:proes
Status:old
Tags:
Comment:
Solved bug: record life span for synonyms and expressions was not always used when displaying defined meaning references. This resulted in old expressions being shown for defined meanings.
Modified paths:
  • /trunk/extensions/Wikidata/WiktionaryZ/Search.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/SpecialDatasearch.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/SpecialSuggest.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/type.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/WiktionaryZ/SpecialDatasearch.php
@@ -34,6 +34,7 @@
3535 "FROM uw_expression_ns, uw_syntrans ".
3636 "WHERE uw_expression_ns.expression_id=uw_syntrans.expression_id AND uw_syntrans.identical_meaning=1 " .
3737 " AND " . getLatestTransactionRestriction('uw_syntrans').
 38+ " AND " . getLatestTransactionRestriction('uw_expression_ns').
3839 " AND spelling LIKE " . $dbr->addQuotes("%$text%") .
3940 " ORDER BY position ASC, uw_expression_ns.spelling ASC limit 100";
4041
Index: trunk/extensions/Wikidata/WiktionaryZ/Search.php
@@ -27,7 +27,8 @@
2828 $sql = "SELECT INSTR(LCASE(uw_expression_ns.spelling), LCASE(". $dbr->addQuotes("$text") .")) as position, uw_syntrans.defined_meaning_id AS defined_meaning_id, uw_expression_ns.spelling AS spelling, uw_expression_ns.language_id AS language_id ".
2929 "FROM uw_expression_ns, uw_syntrans ".
3030 "WHERE uw_expression_ns.expression_id=uw_syntrans.expression_id AND uw_syntrans.identical_meaning=1 " .
31 - " AND " . getLatestTransactionRestriction('uw_syntrans').
 31+ " AND " . getLatestTransactionRestriction('uw_syntrans') .
 32+ " AND " . getLatestTransactionRestriction('uw_expression_ns') .
3233 " AND spelling LIKE " . $dbr->addQuotes("%$text%") .
3334 " ORDER BY position ASC, uw_expression_ns.spelling ASC limit 100";
3435
Index: trunk/extensions/Wikidata/WiktionaryZ/type.php
@@ -72,8 +72,17 @@
7373
7474 function definedMeaningExpressionForLanguage($definedMeaningId, $languageId) {
7575 $dbr =& wfGetDB(DB_SLAVE);
76 - $queryResult = $dbr->query("SELECT spelling FROM uw_syntrans, uw_expression_ns " .
77 - "WHERE defined_meaning_id=$definedMeaningId AND uw_expression_ns.expression_id=uw_syntrans.expression_id AND uw_expression_ns.language_id=$languageId AND uw_syntrans.identical_meaning=1 LIMIT 1");
 76+ $queryResult = $dbr->query(
 77+ "SELECT spelling" .
 78+ " FROM uw_syntrans, uw_expression_ns " .
 79+ " WHERE defined_meaning_id=$definedMeaningId" .
 80+ " AND uw_expression_ns.expression_id=uw_syntrans.expression_id" .
 81+ " AND uw_expression_ns.language_id=$languageId" .
 82+ " AND uw_syntrans.identical_meaning=1" .
 83+ " AND " . getLatestTransactionRestriction('uw_syntrans') .
 84+ " AND " . getLatestTransactionRestriction('uw_expression_ns') .
 85+ " LIMIT 1"
 86+ );
7887
7988 if ($expression = $dbr->fetchObject($queryResult))
8089 return $expression->spelling;
@@ -83,7 +92,15 @@
8493
8594 function definedMeaningExpressionForAnyLanguage($definedMeaningId) {
8695 $dbr =& wfGetDB(DB_SLAVE);
87 - $queryResult = $dbr->query("SELECT spelling from uw_syntrans, uw_expression_ns where defined_meaning_id=$definedMeaningId and uw_expression_ns.expression_id=uw_syntrans.expression_id and uw_syntrans.identical_meaning=1 limit 1");
 96+ $queryResult = $dbr->query(
 97+ "SELECT spelling " .
 98+ " FROM uw_syntrans, uw_expression_ns" .
 99+ " WHERE defined_meaning_id=$definedMeaningId" .
 100+ " AND uw_expression_ns.expression_id=uw_syntrans.expression_id" .
 101+ " AND uw_syntrans.identical_meaning=1" .
 102+ " AND " . getLatestTransactionRestriction('uw_syntrans') .
 103+ " AND " . getLatestTransactionRestriction('uw_expression_ns') .
 104+ " LIMIT 1");
88105
89106 if ($expression = $dbr->fetchObject($queryResult))
90107 return $expression->spelling;
Index: trunk/extensions/Wikidata/WiktionaryZ/SpecialSuggest.php
@@ -59,7 +59,8 @@
6060 $sql = "SELECT syntrans.defined_meaning_id AS defined_meaning_id, expression.spelling AS spelling, expression.language_id AS language_id ".
6161 "FROM uw_expression_ns expression, uw_syntrans syntrans ".
6262 "WHERE expression.expression_id=syntrans.expression_id AND syntrans.identical_meaning=1 " .
63 - " AND " . getLatestTransactionRestriction('syntrans');
 63+ " AND " . getLatestTransactionRestriction('syntrans').
 64+ " AND " . getLatestTransactionRestriction('expression');
6465 break;
6566 case 'collection':
6667 $sql = "SELECT collection_id, spelling ".
@@ -67,6 +68,7 @@
6869 "WHERE expression.expression_id=syntrans.expression_id AND syntrans.defined_meaning_id=collection.collection_mid ".
6970 "AND syntrans.identical_meaning=1" .
7071 " AND " . getLatestTransactionRestriction('syntrans') .
 72+ " AND " . getLatestTransactionRestriction('expression') .
7173 " AND " . getLatestTransactionRestriction('collection');
7274 break;
7375 case 'transaction':
@@ -134,6 +136,7 @@
135137 "AND syntrans.defined_meaning_id=uw_collection_contents.member_mid " .
136138 "AND expression.expression_id=syntrans.expression_id AND syntrans.identical_meaning=1 ".
137139 "AND " . getLatestTransactionRestriction('syntrans') .
 140+ "AND " . getLatestTransactionRestriction('expression') .
138141 "AND " . getLatestTransactionRestriction('uw_collection_contents');
139142 }
140143