Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Store\Sql\SqlEntityIdPager Class Reference

SqlEntityIdPager is a cursor for iterating over the EntityIds stored in the current Wikibase installation. More...

+ Inheritance diagram for Wikibase\Repo\Store\Sql\SqlEntityIdPager:
+ Collaboration diagram for Wikibase\Repo\Store\Sql\SqlEntityIdPager:

Public Member Functions

 __construct (EntityNamespaceLookup $entityNamespaceLookup, EntityIdLookup $entityIdLookup, RepoDomainDb $repoDomainDb, array $entityTypes=[], $redirectMode=EntityIdPager::NO_REDIRECTS, LinkCache $linkCache=null)
 
 fetchIds ( $limit)
 Fetches the next batch of IDs.
 
 getPosition ()
 
 setPosition ( $position)
 
 setCutoffPosition ( $cutoffPosition)
 

Private Member Functions

 getEntityNamespaces (array $entityTypes)
 
 processRows (IResultWrapper $rows)
 Processes the query result: Parse the EntityIds and compute the last position.
 

Private Attributes

 $entityNamespaceLookup
 
 $entityTypes
 
 $redirectMode
 
 $position = 0
 
 $cutoffPosition = null
 
 $entityIdLookup
 
 $db
 
 $linkCache
 

Additional Inherited Members

- Public Attributes inherited from Wikibase\DataModel\Services\EntityId\EntityIdPager
const NO_REDIRECTS = 'no'
 Omit redirects from entity listing.
 
const INCLUDE_REDIRECTS = 'include'
 Include redirects in entity listing.
 
const ONLY_REDIRECTS = 'only'
 Include only redirects in listing.
 

Detailed Description

SqlEntityIdPager is a cursor for iterating over the EntityIds stored in the current Wikibase installation.

Author
Daniel Kinzler
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::__construct ( EntityNamespaceLookup  $entityNamespaceLookup,
EntityIdLookup  $entityIdLookup,
RepoDomainDb  $repoDomainDb,
array  $entityTypes = [],
  $redirectMode = EntityIdPager::NO_REDIRECTS,
LinkCache  $linkCache = null 
)
Parameters
EntityNamespaceLookup$entityNamespaceLookup
EntityIdLookup$entityIdLookup
RepoDomainDb$repoDomainDb
string[]$entityTypesThe desired entity types, or empty array for any type.
string$redirectModeA EntityIdPager::XXX_REDIRECTS constant (default is NO_REDIRECTS).
LinkCache | null$linkCache

Member Function Documentation

◆ fetchIds()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::fetchIds (   $limit)

Fetches the next batch of IDs.

Calling this has the side effect of advancing the internal state of the page, typically implemented by some underlying resource such as a file pointer or a database connection.

Note
After some finite number of calls, this method should eventually return an empty list of IDs, indicating that no more IDs are available.
Parameters
int$limitThe maximum number of IDs to return.
Returns
EntityId[] A list of EntityIds matching the given parameters. Will be empty if there are no more entities to list from the given offset.

Implements Wikibase\DataModel\Services\EntityId\EntityIdPager.

◆ getEntityNamespaces()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::getEntityNamespaces ( array  $entityTypes)
private

◆ getPosition()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::getPosition ( )
Returns
int The last page id fetched.

Implements Wikibase\DataModel\Services\EntityId\SeekableEntityIdPager.

◆ processRows()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::processRows ( IResultWrapper  $rows)
private

Processes the query result: Parse the EntityIds and compute the last position.

Returns an array with said entity ids and the next position or null in case the position didn't change.

Parameters
IResultWrapper$rows
Returns
array Tuple with ( EntityId[], int|null )

◆ setCutoffPosition()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::setCutoffPosition (   $cutoffPosition)
Parameters
int | null$cutoffPositionThe last page id that can be fetched. Null to allow fetching everything.

◆ setPosition()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::setPosition (   $position)
Parameters
int$positionNew pager position. Next fetch will start with page id $position + 1.

Implements Wikibase\DataModel\Services\EntityId\SeekableEntityIdPager.

Member Data Documentation

◆ $cutoffPosition

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$cutoffPosition = null
private

◆ $db

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

◆ $entityIdLookup

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$entityIdLookup
private

◆ $entityNamespaceLookup

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$entityNamespaceLookup
private

◆ $entityTypes

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$entityTypes
private

◆ $linkCache

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$linkCache
private

◆ $position

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$position = 0
private

◆ $redirectMode

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$redirectMode
private

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