Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder Class Reference

Implements initial population (priming) for the wb_changes_subscription table, based on the wb_items_per_site. More...

Public Member Functions

 __construct (RepoDomainDb $db, EntityIdComposer $entityIdComposer, $tableName, $batchSize, $verbosity='standard')
 
 setProgressReporter (MessageReporter $progressReporter)
 
 setExceptionHandler (ExceptionHandler $exceptionHandler)
 
 fillSubscriptionTable (ItemId $startItem=null)
 Fill the subscription table with rows based on entries in wb_items_per_site. More...
 

Private Member Functions

 processSubscriptionBatch (&$continuation=[])
 
 insertSubscriptionBatch (IDatabase $db, array $subscriptionsPerItem)
 
 getSubscriptionsPerItemBatch (IDatabase $db, &$continuation=[])
 
 getSubscriptionsPerItemFromRows (IResultWrapper $res, &$continuation=[])
 
 makeSubscriptionRows ( $itemId, array $subscribers)
 Returns a list of rows for insertion, using Database's multi-row insert mechanism. More...
 

Private Attributes

 $db
 
 $entityIdComposer
 
 $tableName
 
 $batchSize
 
 $exceptionHandler
 
 $progressReporter
 
 $verbosity
 

Detailed Description

Implements initial population (priming) for the wb_changes_subscription table, based on the wb_items_per_site.

Any wiki linked via the wb_items_per_site table will be considered a subscriber.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::__construct ( RepoDomainDb  $db,
EntityIdComposer  $entityIdComposer,
  $tableName,
  $batchSize,
  $verbosity = 'standard' 
)
Parameters
RepoDomainDb$db
EntityIdComposer$entityIdComposer
string$tableName
int$batchSize
string$verbosityEither 'standard' or 'verbose'
Exceptions
InvalidArgumentException

Member Function Documentation

◆ fillSubscriptionTable()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::fillSubscriptionTable ( ItemId  $startItem = null)

Fill the subscription table with rows based on entries in wb_items_per_site.

Parameters
ItemId | null$startItemThe item to start with.

◆ getSubscriptionsPerItemBatch()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::getSubscriptionsPerItemBatch ( IDatabase  $db,
$continuation = [] 
)
private
Parameters
IDatabase$db
array&$continuation
Returns
array[] An associative array mapping item IDs to lists of site IDs.

◆ getSubscriptionsPerItemFromRows()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::getSubscriptionsPerItemFromRows ( IResultWrapper  $res,
$continuation = [] 
)
private
Parameters
IResultWrapper$resA result set with the ips_item_id and ips_site_id fields set for each row.
array&$continuationSingle item ID => site ID pair or empty.
Returns
array[] An associative array mapping item IDs to lists of site IDs.

◆ insertSubscriptionBatch()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::insertSubscriptionBatch ( IDatabase  $db,
array  $subscriptionsPerItem 
)
private
Parameters
IDatabase$db
array[]$subscriptionsPerItem
Returns
int The number of rows inserted.

◆ makeSubscriptionRows()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::makeSubscriptionRows (   $itemId,
array  $subscribers 
)
private

Returns a list of rows for insertion, using Database's multi-row insert mechanism.

Each row is represented as [ $itemId, $subscriber ].

Parameters
string$itemId
string[]$subscribers
Returns
array[] rows

◆ processSubscriptionBatch()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::processSubscriptionBatch ( $continuation = [])
private
Parameters
array&$continuation
Returns
int The number of subscriptions inserted.

◆ setExceptionHandler()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::setExceptionHandler ( ExceptionHandler  $exceptionHandler)

◆ setProgressReporter()

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::setProgressReporter ( MessageReporter  $progressReporter)

Member Data Documentation

◆ $batchSize

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$batchSize
private

◆ $db

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$db
private

◆ $entityIdComposer

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$entityIdComposer
private

◆ $exceptionHandler

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$exceptionHandler
private

◆ $progressReporter

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$progressReporter
private

◆ $tableName

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$tableName
private

◆ $verbosity

Wikibase\Repo\Store\Sql\ChangesSubscriptionTableBuilder::$verbosity
private

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