Translate extension for MediaWiki
 
Loading...
Searching...
No Matches

Mysql based backend. More...

Inheritance diagram for DatabaseTTMServer:
TTMServer WritableTTMServer ReadableTTMServer

Public Member Functions

 update (MessageHandle $handle, $targetText)
 Shovels the new translation into translation memory.
 
 beginBootstrap ()
 Called when starting to fill the translation memory.
 
 beginBatch ()
 Called before every batch (MessageGroup).
 
 batchInsertDefinitions (array $batch)
 Called multiple times per batch if necessary.
 
 batchInsertTranslations (array $batch)
 Called multiple times per batch if necessary.
 
 endBatch ()
 Called before every batch (MessageGroup).
 
 endBootstrap ()
 Do any cleanup, optimizing etc.
 
 isLocalSuggestion (array $suggestion)
 Determines if the suggestion returned by this TTMServer comes from this wiki or any other wiki.
 
 expandLocation (array $suggestion)
 Given suggestion returned by this TTMServer, constructs fully qualified URL to the location of the translation.
 
 query ( $sourceLanguage, $targetLanguage, $text)
 Fetches all relevant suggestions for given text.
 
 setDoReIndex ()
 Instruct the service to fully wipe the index and start from scratch.
 
- Public Member Functions inherited from TTMServer
 __construct (array $config)
 
 getMirrors ()
 
 isFrozen ()
 
- Public Member Functions inherited from WritableTTMServer
 getMirrors ()
 Get the list of services to duplicate writes to make them "mirrors" of this service.
 
 isFrozen ()
 Check if the service is frozen, attempting to write to a frozen service may lead to errors or unexpected behaviors.
 

Protected Member Functions

 getDB ( $mode=DB_REPLICA)
 
 insertSource (Title $context, $sourceLanguage, $text)
 
 filterForFulltext ( $language, $input)
 Tokenizes the text for fulltext search.
 
 processQueryResults ( $res, $text, $targetLanguage)
 

Protected Attributes

 $sids
 
- Protected Attributes inherited from TTMServer
 $config
 

Additional Inherited Members

- Static Public Member Functions inherited from TTMServer
static factory (array $config)
 
static primary ()
 Returns the primary server instance, useful for chaining.
 
static sortSuggestions (array $suggestions)
 
static levenshtein ( $str1, $str2, $length1, $length2)
 PHP implementation of Levenshtein edit distance algorithm.
 
static onDelete (WikiPage $wikipage)
 Hook: ArticleDeleteComplete.
 
static onChange (MessageHandle $handle)
 Called from TranslateEditAddons::onSave.
 
static onGroupChange (MessageHandle $handle, $old)
 

Detailed Description

Mysql based backend.

Since
2012-06-27

Definition at line 20 of file DatabaseTTMServer.php.

Member Function Documentation

◆ batchInsertDefinitions()

DatabaseTTMServer::batchInsertDefinitions ( array $batch)

Called multiple times per batch if necessary.

Parameters
array$batch

Implements WritableTTMServer.

Definition at line 164 of file DatabaseTTMServer.php.

◆ batchInsertTranslations()

DatabaseTTMServer::batchInsertTranslations ( array $batch)

Called multiple times per batch if necessary.

Parameters
array$batch

Implements WritableTTMServer.

Definition at line 175 of file DatabaseTTMServer.php.

◆ beginBatch()

DatabaseTTMServer::beginBatch ( )

Called before every batch (MessageGroup).

Implements WritableTTMServer.

Definition at line 160 of file DatabaseTTMServer.php.

◆ beginBootstrap()

DatabaseTTMServer::beginBootstrap ( )

Called when starting to fill the translation memory.

Set up necessary variables and remove old content from the server.

Implements WritableTTMServer.

Definition at line 146 of file DatabaseTTMServer.php.

◆ endBatch()

DatabaseTTMServer::endBatch ( )

Called before every batch (MessageGroup).

Implements WritableTTMServer.

Definition at line 192 of file DatabaseTTMServer.php.

◆ endBootstrap()

DatabaseTTMServer::endBootstrap ( )

Do any cleanup, optimizing etc.

Implements WritableTTMServer.

Definition at line 195 of file DatabaseTTMServer.php.

◆ expandLocation()

DatabaseTTMServer::expandLocation ( array $suggestion)

Given suggestion returned by this TTMServer, constructs fully qualified URL to the location of the translation.

Parameters
array$suggestion
Returns
string URL

Implements ReadableTTMServer.

Definition at line 207 of file DatabaseTTMServer.php.

◆ filterForFulltext()

DatabaseTTMServer::filterForFulltext ( $language,
$input )
protected

Tokenizes the text for fulltext search.

Tries to find the most useful tokens.

Parameters
string$languageLanguage code
string$input
Returns
array

Definition at line 121 of file DatabaseTTMServer.php.

◆ getDB()

DatabaseTTMServer::getDB ( $mode = DB_REPLICA)
protected
Parameters
int$modeDB_REPLICA|DB_PRIMARY
Returns
\Wikimedia\Rdbms\IDatabase

Definition at line 27 of file DatabaseTTMServer.php.

◆ insertSource()

DatabaseTTMServer::insertSource ( Title $context,
$sourceLanguage,
$text )
protected

Definition at line 89 of file DatabaseTTMServer.php.

◆ isLocalSuggestion()

DatabaseTTMServer::isLocalSuggestion ( array $suggestion)

Determines if the suggestion returned by this TTMServer comes from this wiki or any other wiki.

Parameters
array$suggestion
Returns
bool

Implements ReadableTTMServer.

Definition at line 203 of file DatabaseTTMServer.php.

◆ processQueryResults()

DatabaseTTMServer::processQueryResults ( $res,
$text,
$targetLanguage )
protected

Definition at line 245 of file DatabaseTTMServer.php.

◆ query()

DatabaseTTMServer::query ( $sourceLanguage,
$targetLanguage,
$text )

Fetches all relevant suggestions for given text.

Parameters
string$sourceLanguagelanguage code for the provide text
string$targetLanguagelanguage code for the suggestions
string$textthe text for which to search suggestions
Returns
array List: unordered suggestions, which each has fields:
  • source: String: the original text of the suggestion
  • target: String: the suggestion
  • context: String: title of the page where the suggestion comes from
  • quality: Float: the quality of suggestion, 1 is perfect match

Implements ReadableTTMServer.

Definition at line 213 of file DatabaseTTMServer.php.

◆ setDoReIndex()

DatabaseTTMServer::setDoReIndex ( )

Instruct the service to fully wipe the index and start from scratch.

Since
2020.01

Implements WritableTTMServer.

Definition at line 286 of file DatabaseTTMServer.php.

◆ update()

DatabaseTTMServer::update ( MessageHandle $handle,
$targetText )

Shovels the new translation into translation memory.

Use this for single updates (=after message edit). If no text is provided, entry will be removed from the translation memory.

Parameters
MessageHandle$handle
string | null$targetTextUse null to only delete.

Implements WritableTTMServer.

Definition at line 31 of file DatabaseTTMServer.php.

Member Data Documentation

◆ $sids

DatabaseTTMServer::$sids
protected

Definition at line 21 of file DatabaseTTMServer.php.


The documentation for this class was generated from the following file: