Helper class for updating the wbc_entity_usage table.
More...
Helper class for updating the wbc_entity_usage table.
This is used internally by SqlUsageTracker.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
-
Marius Hoch
◆ __construct()
Wikibase\Client\Usage\Sql\EntityUsageTable::__construct |
( |
EntityIdParser |
$idParser, |
|
|
IDatabase |
$writeConnection, |
|
|
int |
$batchSize = 100 , |
|
|
?string |
$tableName = null , |
|
|
int |
$addUsagesBatchSize = 500 |
|
) |
| |
- Parameters
-
EntityIdParser | $idParser | |
IDatabase | $writeConnection | |
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. |
- Exceptions
-
◆ addUsages()
Wikibase\Client\Usage\Sql\EntityUsageTable::addUsages |
( |
int |
$pageId, |
|
|
array |
$usages |
|
) |
| |
- Parameters
-
- Exceptions
-
- Returns
- int The number of entries added
◆ convertRowsToUsages()
Wikibase\Client\Usage\Sql\EntityUsageTable::convertRowsToUsages |
( |
Traversable |
$rows | ) |
|
|
private |
◆ foldRowsIntoPageEntityUsages()
Wikibase\Client\Usage\Sql\EntityUsageTable::foldRowsIntoPageEntityUsages |
( |
Traversable |
$rows | ) |
|
|
private |
◆ getAffectedRowIds()
Wikibase\Client\Usage\Sql\EntityUsageTable::getAffectedRowIds |
( |
int |
$pageId, |
|
|
array |
$usages |
|
) |
| |
|
private |
- Parameters
-
- Returns
- int[] affected row ids
- Exceptions
-
DBUnexpectedError | |
MWException | |
◆ getEntityIdStrings()
Wikibase\Client\Usage\Sql\EntityUsageTable::getEntityIdStrings |
( |
array |
$entityIds | ) |
|
|
private |
- Parameters
-
- Returns
- string[]
◆ getPagesUsing()
Wikibase\Client\Usage\Sql\EntityUsageTable::getPagesUsing |
( |
array |
$entityIds, |
|
|
array |
$aspects = [] |
|
) |
| |
◆ getPrimaryKeys()
Wikibase\Client\Usage\Sql\EntityUsageTable::getPrimaryKeys |
( |
array |
$where, |
|
|
string |
$method |
|
) |
| |
|
private |
Returns the primary keys for the given where clause.
- Parameters
-
array | $where | |
string | $method | Calling method |
- Returns
- int[]
◆ getUnusedEntities()
Wikibase\Client\Usage\Sql\EntityUsageTable::getUnusedEntities |
( |
array |
$entityIds | ) |
|
◆ getUsedEntityIdStrings()
Wikibase\Client\Usage\Sql\EntityUsageTable::getUsedEntityIdStrings |
( |
array |
$idStrings | ) |
|
|
private |
Returns those entity ids which are used from a given set of entity ids.
- Parameters
-
- Returns
- string[]
◆ getUsedEntityIdStringsMySql()
Wikibase\Client\Usage\Sql\EntityUsageTable::getUsedEntityIdStringsMySql |
( |
array |
$subQueries, |
|
|
IDatabase |
$readConnection |
|
) |
| |
|
private |
- Parameters
-
string[] | $subQueries | |
IDatabase | $readConnection | must have type MySQL |
- Returns
- string[]
◆ getUsedEntityIdStringsQueries()
Wikibase\Client\Usage\Sql\EntityUsageTable::getUsedEntityIdStringsQueries |
( |
array |
$idStrings | ) |
|
|
private |
- Parameters
-
- Returns
- string[]
◆ makeUsageRows()
Wikibase\Client\Usage\Sql\EntityUsageTable::makeUsageRows |
( |
int |
$pageId, |
|
|
array |
$usages |
|
) |
| |
|
private |
- Parameters
-
- Exceptions
-
- Returns
- array[]
◆ pruneUsages()
Wikibase\Client\Usage\Sql\EntityUsageTable::pruneUsages |
( |
int |
$pageId | ) |
|
Removes all usage tracking for a given page.
- Parameters
-
- Exceptions
-
- Returns
- EntityUsage[]
◆ queryUsages()
Wikibase\Client\Usage\Sql\EntityUsageTable::queryUsages |
( |
int |
$pageId | ) |
|
◆ removeUsages()
Wikibase\Client\Usage\Sql\EntityUsageTable::removeUsages |
( |
int |
$pageId, |
|
|
array |
$usages |
|
) |
| |
◆ setAddUsagesBatchSize()
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.
- Parameters
-
◆ $addUsagesBatchSize
Wikibase\Client\Usage\Sql\EntityUsageTable::$addUsagesBatchSize |
|
private |
◆ $batchSize
Wikibase\Client\Usage\Sql\EntityUsageTable::$batchSize |
|
private |
◆ $db
Wikibase\Client\Usage\Sql\EntityUsageTable::$db |
|
private |
◆ $idParser
Wikibase\Client\Usage\Sql\EntityUsageTable::$idParser |
|
private |
◆ $logger
Wikibase\Client\Usage\Sql\EntityUsageTable::$logger |
|
private |
◆ $tableName
Wikibase\Client\Usage\Sql\EntityUsageTable::$tableName |
|
private |
◆ $writeConnection
Wikibase\Client\Usage\Sql\EntityUsageTable::$writeConnection |
|
private |
◆ DEFAULT_TABLE_NAME
const Wikibase\Client\Usage\Sql\EntityUsageTable::DEFAULT_TABLE_NAME = 'wbc_entity_usage' |
The documentation for this class was generated from the following file: