Wikibase
MediaWiki Wikibase extension
|
Public Member Functions | |
acquireTermInLangIds (array $termsArray, $callback=null) | |
Acquires IDs for the given terms. | |
resolveTermInLangIds (array $termInLangIds, array $types=null, array $languages=null) | |
Resolves terms for the given term in lang IDs. | |
resolveGroupedTermInLangIds (array $groupedTermInLangIds, array $types=null, array $languages=null) | |
Resolves terms for the given groups of term in lang IDs. | |
cleanTermInLangIds (array $termInLangIds) | |
Delete the given term in lang IDs. | |
Private Attributes | |
$terms = [] | |
$lastId = 0 | |
Wikibase\Lib\Store\Sql\Terms\InMemoryTermStore::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.
Wikibase\Lib\Store\Sql\Terms\InMemoryTermStore::cleanTermInLangIds | ( | array | $termInLangIds | ) |
Delete the given term in lang IDs.
Ensuring that they are unreferenced is the caller’s responsibility.
Depending on the implementation, this may include further internal cleanups. In that case, the implementation takes care that those cleanups do not affect other (not deleted) term in lang IDs.
int[] | $termInLangIds |
Implements Wikibase\Lib\Store\Sql\Terms\TermStoreCleaner.
Wikibase\Lib\Store\Sql\Terms\InMemoryTermStore::resolveGroupedTermInLangIds | ( | array | $groupedTermInLangIds, |
array | $types = null, | ||
array | $languages = null ) |
Resolves terms for the given groups of term in lang IDs.
The input is an array of term in lang ID arrays, with arbitrary keys. The return value is an array of terms structures, with the same keys, where the values belong to the term in lang IDs corresponding to that key. One call to this method is effectively equivalent to multiple calls to resolveTermInLangIds
with the individual term in lang ID arrays, but may be more efficient than that, e.g. resolving all the term in lang IDs in one batch and then grouping them correctly afterwards.
int[][] | $groupedTermInLangIds | |
null | string[] | $types | If not null, only include results of these types |
null | string[] | $languages | If not null, only include results in these languages |
Implements Wikibase\Lib\Store\Sql\Terms\TermInLangIdsResolver.
Wikibase\Lib\Store\Sql\Terms\InMemoryTermStore::resolveTermInLangIds | ( | array | $termInLangIds, |
array | $types = null, | ||
array | $languages = null ) |
Resolves terms for the given term in lang IDs.
Note that the information whether the leaf nodes were single strings or arrays of strings is lost: while TermInLangIdsAcquirer::acquireTermInLangIds
accepts both, this method always returns arrays of strings.
int[] | $termInLangIds | |
null | string[] | $types | If not null, only include results of these types |
null | string[] | $languages | If not null, only include results in these languages |
Implements Wikibase\Lib\Store\Sql\Terms\TermInLangIdsResolver.
|
private |
|
private |