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, 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, $revisionId, $connType)
 Selects revision information from the page and revision tables. More...
 
 selectRevisionInformationMultiple (array $entityIds, $connType)
 Selects revision information from the page and revision tables. More...
 
 selectLatestRevisionIdsMultiple (array $entityIds, $connType)
 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
 

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,
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,
  $connType 
)
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.
int$connTypeDB_REPLICA or DB_MASTER
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,
  $revisionId,
  $connType 
)
private

Selects revision information from the page and revision tables.

Parameters
EntityId$entityIdThe entity to query the DB for.
int$revisionIdThe desired revision id
int$connTypeDB_REPLICA or DB_MASTER
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,
  $connType 
)
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.
int$connTypeDB_REPLICA or DB_MASTER
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

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