Wikibase
MediaWiki Wikibase extension
|
Helper class for updating the wbc_entity_usage table. More...
Public Member Functions | |
__construct (EntityIdParser $idParser, ?IDatabase $writeConnection, int $batchSize=100, ?string $tableName=null, int $addUsagesBatchSize=500) | |
addUsages (int $pageId, array $usages) | |
queryUsages (int $pageId) | |
pruneUsages (int $pageId) | |
Removes all usage tracking for a given page. | |
removeUsages (int $pageId, array $usages) | |
getPagesUsing (array $entityIds, array $aspects=[]) | |
getUnusedEntities (array $entityIds) | |
setAddUsagesBatchSize (int $addUsagesBatchSize) | |
Set the batch size for adding entity usage records. | |
Public Attributes | |
const | DEFAULT_TABLE_NAME = 'wbc_entity_usage' |
Private Member Functions | |
getWriteConnection () | |
getAffectedRowIds (int $pageId, array $usages) | |
makeUsageRows (int $pageId, array $usages) | |
getEntityIdStrings (array $entityIds) | |
convertRowsToUsages (Traversable $rows) | |
foldRowsIntoPageEntityUsages (Traversable $rows) | |
getUsedEntityIdStrings (array $idStrings) | |
Returns those entity ids which are used from a given set of entity ids. | |
getUsedEntityIdStringsQueries (array $idStrings) | |
getPrimaryKeys (array $where, string $method) | |
Returns the primary keys for the given where clause. | |
getUsedEntityIdStringsMySql (array $subQueries, IReadableDatabase $readConnection) | |
Private Attributes | |
EntityIdParser | $idParser |
IDatabase | $writeConnection |
ClientDomainDb | $db |
int | $batchSize |
string | $tableName |
int | $addUsagesBatchSize |
LoggerInterface | $logger |
Helper class for updating the wbc_entity_usage table.
This is used internally by SqlUsageTracker.
Wikibase\Client\Usage\Sql\EntityUsageTable::__construct | ( | EntityIdParser | $idParser, |
?IDatabase | $writeConnection, | ||
int | $batchSize = 100, | ||
?string | $tableName = null, | ||
int | $addUsagesBatchSize = 500 ) |
EntityIdParser | $idParser | |
IDatabase | null | $writeConnection | If null, this instance can only be used for “read” queries. |
int | $batchSize | Batch size for database queries on the entity usage table, including INSERTs, SELECTs, and DELETEs. Defaults to 100. |
string | null | $tableName | defaults to wbc_entity_usage |
int | $addUsagesBatchSize | Batch size for adding entity usage records. Can also be set after construction. |
InvalidArgumentException |
Wikibase\Client\Usage\Sql\EntityUsageTable::addUsages | ( | int | $pageId, |
array | $usages ) |
int | $pageId | |
EntityUsage[] | $usages |
InvalidArgumentException |
|
private |
Traversable | $rows |
|
private |
Traversable | $rows |
|
private |
int | $pageId | |
EntityUsage[] | $usages |
|
private |
EntityId[] | $entityIds |
Wikibase\Client\Usage\Sql\EntityUsageTable::getPagesUsing | ( | array | $entityIds, |
array | $aspects = [] ) |
EntityId[] | $entityIds | |
string[] | $aspects |
|
private |
Returns the primary keys for the given where clause.
array | $where | |
string | $method | Calling method |
Wikibase\Client\Usage\Sql\EntityUsageTable::getUnusedEntities | ( | array | $entityIds | ) |
EntityId[] | $entityIds |
|
private |
Returns those entity ids which are used from a given set of entity ids.
string[] | $idStrings |
|
private |
SelectQueryBuilder[] | $subQueries | |
IReadableDatabase | $readConnection | must have type MySQL |
|
private |
string[] | $idStrings |
|
private |
|
private |
int | $pageId | |
EntityUsage[] | $usages |
InvalidArgumentException |
Wikibase\Client\Usage\Sql\EntityUsageTable::pruneUsages | ( | int | $pageId | ) |
Removes all usage tracking for a given page.
int | $pageId |
InvalidArgumentException |
Wikibase\Client\Usage\Sql\EntityUsageTable::queryUsages | ( | int | $pageId | ) |
int | $pageId |
InvalidArgumentException |
Wikibase\Client\Usage\Sql\EntityUsageTable::removeUsages | ( | int | $pageId, |
array | $usages ) |
int | $pageId | |
EntityUsage[] | $usages |
InvalidArgumentException |
Wikibase\Client\Usage\Sql\EntityUsageTable::setAddUsagesBatchSize | ( | int | $addUsagesBatchSize | ) |
Set the batch size for adding entity usage records.
This can also be set in the constructor.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
const Wikibase\Client\Usage\Sql\EntityUsageTable::DEFAULT_TABLE_NAME = 'wbc_entity_usage' |