Wikibase
MediaWiki Wikibase extension
|
A TermInLangIdsAcquirer
implementation using the database tables wbt_term_in_lang, wbt_text_in_lang, and wbt_text.
More...
Public Member Functions | |
__construct (ILBFactory $lbFactory, TypeIdsAcquirer $typeIdsAcquirer, LoggerInterface $logger=null) | |
acquireTermInLangIds (array $termsArray, $callback=null) | |
Acquires IDs for the given terms. | |
Private Member Functions | |
getLoadBalancer () | |
mapToTypeIds (array $termsArray) | |
replace root keys containing type names in termsArray with their respective ids in wbt_type table | |
mapToTextIds (array $termsArray, ReplicaMasterAwareRecordIdsAcquirer $textIdsAcquirer) | |
replace text at termsArray leaves with their ids in wbt_text table and return resulting array | |
acquireTextIds (array $texts, ReplicaMasterAwareRecordIdsAcquirer $textIdsAcquirer) | |
mapToTextInLangIds (array $termsArray, ReplicaMasterAwareRecordIdsAcquirer $textInLangIdsAcquirer) | |
replace ( lang => [ textId, ... ] ) entries with their respective ids in wbt_text_in_lang table and return resulting array | |
acquireTextInLangIds (array $langTextIds, ReplicaMasterAwareRecordIdsAcquirer $textInLangIdsAcquirer) | |
mapToTermInLangIds (array $termsArray, ReplicaMasterAwareRecordIdsAcquirer $termInLangIdsAcquirer, array $idsToRestore=[]) | |
replace root ( type => [ textInLangId, ... ] ) entries with their respective ids in wbt_term_in_lang table and return resulting array | |
acquireTermInLangIdsInner (array $typeTextInLangIds, ReplicaMasterAwareRecordIdsAcquirer $termInLangIdsAcquirer, array $idsToRestore=[]) | |
restoreCleanedUpIds (array $termsArray, array $termInLangIds=[]) | |
mapTermsArrayToTermIds (array $termsArray, array $termInLangIdsToRestore=[], $ignoreReplica=false) | |
calcRecordHash (array $record) | |
filterUniqueRecords (array $records) | |
Private Attributes | |
$lbFactory | |
$typeIdsAcquirer | |
$logger | |
A TermInLangIdsAcquirer
implementation using the database tables wbt_term_in_lang, wbt_text_in_lang, and wbt_text.
Because the wbt_text.wbx_text column can only hold up to 255 bytes, terms longer than that (typically non-Latin descriptions) will be truncated, and different terms that only differ after the first 255 bytes will get the same term in lang ID (and thus same other ids too).
Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsAcquirer::__construct | ( | ILBFactory | $lbFactory, |
TypeIdsAcquirer | $typeIdsAcquirer, | ||
LoggerInterface | $logger = null |
||
) |
ILBFactory | $lbFactory | |
TypeIdsAcquirer | $typeIdsAcquirer | |
LoggerInterface | null | $logger |
Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsAcquirer::acquireTermInLangIds | ( | array | $termsArray, |
$callback = null |
|||
) |
Acquires IDs for the given terms.
The acquirer guarantees that an in-parallel TermStoreCleaner
will not result in deleting terms that have been acquired by this acquirer, should these two in-parallel processes happen to overlap on some existing term in lang IDs. The mechanism of achieving this guarantee is complete under the following two conditions:
array | $termsArray | array containing terms per type per language. Example: [ 'label' => [ 'en' => 'some label', 'de' => 'another label', ... ], 'alias' => [ 'en' => [ 'alias', 'another alias', ...], 'de' => 'de alias', ... ], ... ] |
callable | null | $callback | Called with int[] $termInLangIds right before attempting to restore any of those acquired IDs that might have been deleted by another process before acquireTermInLangIds() has returned. |
Implements Wikibase\Lib\Store\Sql\Terms\TermInLangIdsAcquirer.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
replace root ( type => [ textInLangId, ... ] ) entries with their respective ids in wbt_term_in_lang table and return resulting array
array | $termsArray | text in lang ids per type [ 'type' => [ <textInLangId1>, <textInLangId2>, ... ], ... ] |
ReplicaMasterAwareRecordIdsAcquirer | $termInLangIdsAcquirer | |
array | $idsToRestore |
|
private |
replace text at termsArray leaves with their ids in wbt_text table and return resulting array
array | $termsArray | terms per type per language: [ 'type' => [ [ 'language' => 'term' | [ 'term1', 'term2', ... ] ], ... ], ... ] |
ReplicaMasterAwareRecordIdsAcquirer | $textIdsAcquirer |
|
private |
replace ( lang => [ textId, ... ] ) entries with their respective ids in wbt_text_in_lang table and return resulting array
array | $termsArray | text ids per type per language [ 'type' => [ [ 'language' => [ <textId1>, <textId2>, ... ] ], ... ], ... ] |
ReplicaMasterAwareRecordIdsAcquirer | $textInLangIdsAcquirer |
|
private |
replace root keys containing type names in termsArray with their respective ids in wbt_type table
array | $termsArray | terms per type per language: [ 'type1' => [ ... ], 'type2' => [ ... ], ... ] |
|
private |
|
private |
|
private |
|
private |