r110213 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110212‎ | r110213 | r110214 >
Date:16:55, 28 January 2012
Author:nikerabbit
Status:ok (Comments)
Tags:i18nreview, miscextensions 
Comment:
Database tables for tm, tested on MySQL, unlikely to work for SQLite or PostgreSQL
Modified paths:
  • /trunk/extensions/Translate/TranslateHooks.php (modified) (history)
  • /trunk/extensions/Translate/sql/translate_tm.sql (added) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateHooks.php
@@ -186,6 +186,7 @@
187187 $updater->addExtensionUpdate( array( 'dropIndex', 'translate_sections', 'trs_page', "$dir/translate_sections-indexchange2.sql", true ) );
188188 $updater->addExtensionUpdate( array( 'addTable', 'translate_reviews', "$dir/translate_reviews.sql", true ) );
189189 $updater->addExtensionUpdate( array( 'addTable', 'translate_groupreviews', "$dir/translate_groupreviews.sql", true ) );
 190+ $updater->addExtensionUpdate( array( 'addTable', 'translate_tms', "$dir/translate_tm.sql", true ) );
190191
191192 return true;
192193 }
Index: trunk/extensions/Translate/sql/translate_tm.sql
@@ -0,0 +1,38 @@
 2+-- Since these tables only store secondary data,
 3+-- it should be safe to drop them from time to time.
 4+-- MediaWiki itself guarantees sure that this file is run only once.
 5+
 6+-- Source texts
 7+DROP TABLE IF EXISTS /*_*/translate_tms;
 8+CREATE TABLE /*_*/translate_tms (
 9+ tms_sid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
 10+ -- Language code
 11+ tms_lang varchar(20) binary NOT NULL,
 12+ -- Lenght of the string in characters
 13+ tms_len int unsigned NOT NULL,
 14+ -- The actual text
 15+ tms_text mediumblob NOT NULL,
 16+ -- Identifier where this text came from
 17+ tms_context mediumblob NOT NULL default ''
 18+) /*$wgDBTableOptions*/;
 19+
 20+CREATE INDEX /*i*/tms_lang_len ON /*_*/translate_tms (tms_lang, tms_len);
 21+
 22+-- Stored translations
 23+DROP TABLE IF EXISTS /*_*/translate_tmt;
 24+CREATE TABLE /*_*/translate_tmt (
 25+ tmt_sid int unsigned NOT NULL,
 26+ tmt_lang varchar(20) binary NOT NULL,
 27+ tmt_text mediumblob NOT NULL
 28+) /*$wgDBTableOptions*/;
 29+
 30+CREATE UNIQUE INDEX /*i*/tmt_sid_lang ON /*_*/translate_tmt (tmt_sid, tmt_lang);
 31+
 32+-- Fulltext search index
 33+DROP TABLE IF EXISTS /*_*/translate_tmf;
 34+CREATE TABLE /*_*/translate_tmf (
 35+ tmf_sid int unsigned NOT NULL,
 36+ tmf_text text
 37+) ENGINE=MYISAM;
 38+
 39+CREATE FULLTEXT INDEX /*i*/tmf_text ON /*_*/translate_tmf (tmf_text);
Property changes on: trunk/extensions/Translate/sql/translate_tm.sql
___________________________________________________________________
Added: svn:eol-style
140 + native

Comments

#Comment by Santhosh.thottingal (talk | contribs)   06:05, 1 February 2012

Why we need blob type for tms_context? tms_context mediumblob NOT NULL default

#Comment by Nikerabbit (talk | contribs)   10:18, 1 February 2012

That seems to be most used type for this type of fields.

Status & tagging log