Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup Class Reference

Service for looking up meta data about one or more entities as needed for loading entities from WikiPages (via Revision) or to verify an entity against page.page_latest. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup:

Public Member Functions

 __construct (EntityNamespaceLookup $entityNamespaceLookup, PageTableEntityQuery $pageTableEntityConditionGenerator, EntitySource $entitySource, RepoDomainDb $repoDb, LoggerInterface $logger=null)
 
 loadRevisionInformationByRevisionId (EntityId $entityId, $revisionId, $mode=LookupConstants::LATEST_FROM_MASTER)
 
- Public Member Functions inherited from Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor
 loadRevisionInformation (array $entityIds, $mode)
 Looks up meta data for the given entityId(s) as needed to lookup the latest revision id of an entity or to load entity content from a MediaWiki revision. More...
 
 loadLatestRevisionIds (array $entityIds, $mode)
 Looks up the latest revision ID(s) for the given entityId(s). More...
 

Private Member Functions

 assertCanHandleEntityIds (array $entityIds)
 
 assertCanHandleEntityId (EntityId $entityId)
 
 selectFields ()
 Fields we need to select to load a revision. More...
 
 selectRevisionInformationById (EntityId $entityId, int $revisionId, IDatabase $db)
 Selects revision information from the page and revision tables. More...
 
 selectRevisionInformationMultiple (array $entityIds, IDatabase $db)
 Selects revision information from the page and revision tables. More...
 
 selectLatestRevisionIdsMultiple (array $entityIds, IDatabase $db)
 Selects page_latest information from the page table. More...
 
 processRows (array $entityIds, array $rows)
 Takes an array of rows and returns a result where every given entity ID has some value. More...
 

Private Attributes

 $entityNamespaceLookup
 
 $pageTableEntityQuery
 
 $logger
 
 $entitySource
 
 $repoDb
 

Detailed Description

Service for looking up meta data about one or more entities as needed for loading entities from WikiPages (via Revision) or to verify an entity against page.page_latest.

This lookup makes the assumption that the page title storing the entity matches the local ID part of the entity ID as this class queries against the page_title field of the page table.

Author
Daniel Kinzler
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::__construct ( EntityNamespaceLookup  $entityNamespaceLookup,
PageTableEntityQuery  $pageTableEntityConditionGenerator,
EntitySource  $entitySource,
RepoDomainDb  $repoDb,
LoggerInterface  $logger = null 
)

Member Function Documentation

◆ assertCanHandleEntityId()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::assertCanHandleEntityId ( EntityId  $entityId)
private

◆ assertCanHandleEntityIds()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::assertCanHandleEntityIds ( array  $entityIds)
private
Parameters
EntityId[]$entityIds
Exceptions
InvalidArgumentExceptionWhen some of $entityIds cannot be handled by this lookup

◆ loadRevisionInformationByRevisionId()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::loadRevisionInformationByRevisionId ( EntityId  $entityId,
  $revisionId,
  $mode = LookupConstants::LATEST_FROM_MASTER 
)
Parameters
EntityId$entityId
int$revisionId
string$mode(WikiPageEntityMetaDataAccessor::LATEST_FROM_REPLICA, WikiPageEntityMetaDataAccessor::LATEST_FROM_REPLICA_WITH_FALLBACK or WikiPageEntityMetaDataAccessor::LATEST_FROM_MASTER)
Exceptions
DBQueryError
InvalidArgumentExceptionWhen $entityId does not belong the repository of this lookup
Returns
stdClass|bool

Implements Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor.

◆ processRows()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::processRows ( array  $entityIds,
array  $rows 
)
private

Takes an array of rows and returns a result where every given entity ID has some value.

Parameters
EntityId[]$entityIds
stdClass[]$rowsindexed by entity id serialization
Returns
(stdClass|false)[] Array mapping entity ID serializations to either objects or false if an entity is not present in $res.

◆ selectFields()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::selectFields ( )
private

Fields we need to select to load a revision.

Returns
string[]

◆ selectLatestRevisionIdsMultiple()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::selectLatestRevisionIdsMultiple ( array  $entityIds,
IDatabase  $db 
)
private

Selects page_latest information from the page table.

Returns an array like entityid -> int or false (if not found).

Parameters
EntityId[]$entityIdsThe entities to query the DB for.
IDatabase$dbconnection to the DB_REPLICA or DB_PRIMARY database to query from
Exceptions
DBQueryErrorIf the query fails.
Returns
array Array mapping entity ID serializations to either ints or false if an entity could not be found (including if the page is a redirect).

◆ selectRevisionInformationById()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::selectRevisionInformationById ( EntityId  $entityId,
int  $revisionId,
IDatabase  $db 
)
private

Selects revision information from the page and revision tables.

Parameters
EntityId$entityIdThe entity to query the DB for.
int$revisionIdThe desired revision id
IDatabase$dbA connection to either DB_REPLICA or DB_PRIMARY
Exceptions
DBQueryErrorIf the query fails.
Returns
stdClass|bool a raw database row object, or false if no such entity revision exists.

◆ selectRevisionInformationMultiple()

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::selectRevisionInformationMultiple ( array  $entityIds,
IDatabase  $db 
)
private

Selects revision information from the page and revision tables.

Returns an array like entityid -> object or false (if not found).

Parameters
EntityId[]$entityIdsThe entities to query the DB for.
IDatabase$dbconnection to DB_REPLICA or DB_PRIMARY database to query
Exceptions
DBQueryErrorIf the query fails.
Returns
(stdClass|false)[] Array mapping entity ID serializations to either objects or false if an entity could not be found.

Member Data Documentation

◆ $entityNamespaceLookup

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::$entityNamespaceLookup
private

◆ $entitySource

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::$entitySource
private

◆ $logger

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::$logger
private

◆ $pageTableEntityQuery

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::$pageTableEntityQuery
private

◆ $repoDb

Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup::$repoDb
private

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