Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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, int $entityUsagePerPageLimit, int $addEntityUsagesBatchSize=500)
 
 addUsedEntities (int $pageId, array $usages)
 
 replaceUsedEntities (int $pageId, array $usages)
 
 pruneUsages (int $pageId)
 
 getUsagesForPage (int $pageId)
 
 getPagesUsing (array $entityIds, array $aspects=[])
 
 getUnusedEntities (array $entityIds)
 

Private Member Functions

 newUsageTable (?IDatabase $db=null)
 
 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.
 
 handleDisabledUsages (array $usages)
 

Private Attributes

EntityIdParser $idParser
 
SessionConsistentConnectionManager $connectionManager
 
array $disabledUsageAspects
 
int $entityUsagePerPageLimit
 The limit to issue a warning when entity usage per page hit that limit.
 
int $addEntityUsagesBatchSize
 The batch size when adding entity usage.
 

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,
int $entityUsagePerPageLimit,
int $addEntityUsagesBatchSize = 500 )
Parameters
EntityIdParser$idParser
SessionConsistentConnectionManager$connectionManager
string[]$disabledUsageAspects
int$entityUsagePerPageLimit
int$addEntityUsagesBatchSize

Member Function Documentation

◆ addUsedEntities()

Wikibase\Client\Usage\Sql\SqlUsageTracker::addUsedEntities ( int $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 ( int $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 = null)
private

◆ pruneUsages()

Wikibase\Client\Usage\Sql\SqlUsageTracker::pruneUsages ( int $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 ( int $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

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

The batch size when adding entity usage.

◆ $connectionManager

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

◆ $disabledUsageAspects

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

◆ $entityUsagePerPageLimit

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

The limit to issue a warning when entity usage per page hit that limit.

◆ $idParser

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

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