Wikibase
MediaWiki Wikibase extension
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, ILBFactory $lbFactory, $batchSize=1000, $usageTableName=null)
 
 setProgressReporter (MessageReporter $progressReporter)
 
 setExceptionHandler (ExceptionHandler $exceptionHandler)
 
 fillUsageTable ( $fromPageId=0)
 Fill the usage table with rows based on entries in page_props. More...
 

Private Member Functions

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

Private Attributes

 $idParser
 
 $lbFactory
 
 $usageTableName
 
 $batchSize
 
 $exceptionHandler
 
 $progressReporter
 

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,
ILBFactory  $lbFactory,
  $batchSize = 1000,
  $usageTableName = null 
)
Parameters
EntityIdParser$idParser
ILBFactory$lbFactory
int$batchSizedefaults to 1000
string | null$usageTableNamedefaults to wbc_entity_usage
Exceptions
InvalidArgumentException

Member Function Documentation

◆ fillUsageTable()

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

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

Parameters
int$fromPageId

◆ getUsageBatch()

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

◆ insertUsageBatch()

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

◆ processUsageBatch()

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::processUsageBatch ( $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
Parameters
IResultWrapper$res
Returns
EntityId[] An associative array mapping page IDs to Entity IDs.

Member Data Documentation

◆ $batchSize

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

◆ $exceptionHandler

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

◆ $idParser

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

◆ $lbFactory

Wikibase\Client\Usage\Sql\EntityUsageTableBuilder::$lbFactory
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: