Wikibase
MediaWiki Wikibase extension
Wikibase\Client\Usage\Sql\SqlUsageTracker Class Reference

An SQL based usage tracker implementation. More...

+ Inheritance diagram for Wikibase\Client\Usage\Sql\SqlUsageTracker:
+ Collaboration diagram for Wikibase\Client\Usage\Sql\SqlUsageTracker:

Public Member Functions

 __construct (EntityIdParser $idParser, SessionConsistentConnectionManager $connectionManager, array $disabledUsageAspects, $entityUsagePerPageLimit, $addEntityUsagesBatchSize=500)
 
 addUsedEntities ( $pageId, array $usages)
 
 replaceUsedEntities ( $pageId, array $usages)
 
 pruneUsages ( $pageId)
 
 getUsagesForPage ( $pageId)
 
 getPagesUsing (array $entityIds, array $aspects=[])
 
 getUnusedEntities (array $entityIds)
 

Private Member Functions

 newUsageTable (IDatabase $db)
 
 reindexEntityUsages (array $usages)
 Re-indexes the given list of EntityUsages so that each EntityUsage can be found by using its string representation as a key. More...
 
 handleDisabledUsages (array $usages)
 

Private Attributes

 $idParser
 
 $connectionManager
 
 $disabledUsageAspects
 
 $entityUsagePerPageLimit
 
 $addEntityUsagesBatchSize
 

Detailed Description

An SQL based usage tracker implementation.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Usage\Sql\SqlUsageTracker::__construct ( EntityIdParser  $idParser,
SessionConsistentConnectionManager  $connectionManager,
array  $disabledUsageAspects,
  $entityUsagePerPageLimit,
  $addEntityUsagesBatchSize = 500 
)
Parameters
EntityIdParser$idParser
SessionConsistentConnectionManager$connectionManager
string[]$disabledUsageAspects
int$entityUsagePerPageLimit
int$addEntityUsagesBatchSize

Member Function Documentation

◆ addUsedEntities()

Wikibase\Client\Usage\Sql\SqlUsageTracker::addUsedEntities (   $pageId,
array  $usages 
)
See also
UsageTracker::addUsedEntities
Parameters
int$pageId
EntityUsage[]$usages
Exceptions
InvalidArgumentException

Implements Wikibase\Client\Usage\UsageTracker.

◆ getPagesUsing()

Wikibase\Client\Usage\Sql\SqlUsageTracker::getPagesUsing ( array  $entityIds,
array  $aspects = [] 
)
See also
UsageLookup::getPagesUsing
Parameters
EntityId[]$entityIds
string[]$aspects
Returns
Traversable A traversable over PageEntityUsages grouped by page.

Implements Wikibase\Client\Usage\UsageLookup.

◆ getUnusedEntities()

Wikibase\Client\Usage\Sql\SqlUsageTracker::getUnusedEntities ( array  $entityIds)
See also
UsageLookup::getUnusedEntities
Parameters
EntityId[]$entityIds
Returns
EntityId[]

Implements Wikibase\Client\Usage\UsageLookup.

◆ getUsagesForPage()

Wikibase\Client\Usage\Sql\SqlUsageTracker::getUsagesForPage (   $pageId)
See also
UsageLookup::getUsagesForPage
Parameters
int$pageId
Returns
EntityUsage[] EntityUsage identity string => EntityUsage

Implements Wikibase\Client\Usage\UsageLookup.

◆ handleDisabledUsages()

Wikibase\Client\Usage\Sql\SqlUsageTracker::handleDisabledUsages ( array  $usages)
private
Parameters
EntityUsage[]$usages
Exceptions
InvalidArgumentException
Returns
EntityUsage[]

◆ newUsageTable()

Wikibase\Client\Usage\Sql\SqlUsageTracker::newUsageTable ( IDatabase  $db)
private
Parameters
IDatabase$db
Returns
EntityUsageTable

◆ pruneUsages()

Wikibase\Client\Usage\Sql\SqlUsageTracker::pruneUsages (   $pageId)
See also
UsageTracker::pruneUsages
Parameters
int$pageId
Returns
EntityUsage[]

Implements Wikibase\Client\Usage\UsageTracker.

◆ reindexEntityUsages()

Wikibase\Client\Usage\Sql\SqlUsageTracker::reindexEntityUsages ( array  $usages)
private

Re-indexes the given list of EntityUsages so that each EntityUsage can be found by using its string representation as a key.

Parameters
EntityUsage[]$usages
Exceptions
InvalidArgumentException
Returns
EntityUsage[]

◆ replaceUsedEntities()

Wikibase\Client\Usage\Sql\SqlUsageTracker::replaceUsedEntities (   $pageId,
array  $usages 
)
See also
UsageTracker::replaceUsedEntities
Parameters
int$pageId
EntityUsage[]$usages
Returns
EntityUsage[] Usages that have been removed
Exceptions
InvalidArgumentException

Implements Wikibase\Client\Usage\UsageTracker.

Member Data Documentation

◆ $addEntityUsagesBatchSize

Wikibase\Client\Usage\Sql\SqlUsageTracker::$addEntityUsagesBatchSize
private

◆ $connectionManager

Wikibase\Client\Usage\Sql\SqlUsageTracker::$connectionManager
private

◆ $disabledUsageAspects

Wikibase\Client\Usage\Sql\SqlUsageTracker::$disabledUsageAspects
private

◆ $entityUsagePerPageLimit

Wikibase\Client\Usage\Sql\SqlUsageTracker::$entityUsagePerPageLimit
private

◆ $idParser

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

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