Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Usage\Sql\EntityUsageTableBuilder Class Reference

Implements initial population (priming) for the wbc_entity_usage table, based on "wikibase_item" entries in the page_props table. More...

Public Member Functions

 __construct (EntityIdParser $idParser, ClientDomainDb $domainDb, int $batchSize=1000, ?string $usageTableName=null)
 
 setProgressReporter (MessageReporter $progressReporter)
 
 setExceptionHandler (ExceptionHandler $exceptionHandler)
 
 fillUsageTable (int $fromPageId=0)
 Fill the usage table with rows based on entries in page_props.
 

Private Member Functions

 processUsageBatch (int &$fromPageId=0)
 
 insertUsageBatch (IDatabase $dbw, array $entityPerPage)
 
 getUsageBatch (IReadableDatabase $db, int $fromPageId=0)
 
 slurpEntityIds (IResultWrapper $res)
 

Private Attributes

 $idParser
 
 $usageTableName
 
 $batchSize
 
 $exceptionHandler
 
 $progressReporter
 
 $domainDb
 

Detailed Description

Implements initial population (priming) for the wbc_entity_usage table, based on "wikibase_item" entries in the page_props table.

All usages will be marked as EntityUsage::ALL_USAGE ("X"), since we do not know which aspects are actually used beyond the sitelinks aspect. The "X" aspect will cause the page to be purged for any kind of change to the respective data item; once the page is re-parse, the "X" aspect would be removed with whatever aspect(s) are actually used on the page.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::__construct ( EntityIdParser $idParser,
ClientDomainDb $domainDb,
int $batchSize = 1000,
?string $usageTableName = null )
Exceptions
InvalidArgumentException

Member Function Documentation

◆ fillUsageTable()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::fillUsageTable ( int $fromPageId = 0)

Fill the usage table with rows based on entries in page_props.

◆ getUsageBatch()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::getUsageBatch ( IReadableDatabase $db,
int $fromPageId = 0 )
private
Returns
EntityId[] An associative array mapping page IDs to Entity IDs.

◆ insertUsageBatch()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::insertUsageBatch ( IDatabase $dbw,
array $entityPerPage )
private
Parameters
IDatabase$dbw
EntityId[]$entityPerPage
Returns
int The number of rows inserted.

◆ processUsageBatch()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::processUsageBatch ( int & $fromPageId = 0)
private
Parameters
int&$fromPageIdPage ID to start from. Will be updated with the next unprocessed ID, to be used as the starting point of the next batch. Pages are processed in order of their ID.
Returns
int The number of entity usages inserted.

◆ setExceptionHandler()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::setExceptionHandler ( ExceptionHandler $exceptionHandler)

◆ setProgressReporter()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::setProgressReporter ( MessageReporter $progressReporter)

◆ slurpEntityIds()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::slurpEntityIds ( IResultWrapper $res)
private
Returns
EntityId[] An associative array mapping page IDs to Entity IDs.

Member Data Documentation

◆ $batchSize

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$batchSize
private

◆ $domainDb

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$domainDb
private

◆ $exceptionHandler

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$exceptionHandler
private

◆ $idParser

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$idParser
private

◆ $progressReporter

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$progressReporter
private

◆ $usageTableName

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$usageTableName
private

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