Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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, DatabaseEntitySource $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.
 
 loadLatestRevisionIds (array $entityIds, $mode)
 Looks up the latest revision ID(s) for the given entityId(s).
 

Private Member Functions

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

Private Attributes

EntityNamespaceLookup $entityNamespaceLookup
 
PageTableEntityQuery $pageTableEntityQuery
 
LoggerInterface $logger
 
DatabaseEntitySource $entitySource
 
RepoDomainDb $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,
DatabaseEntitySource $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,
IReadableDatabase $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.
IReadableDatabase$dbconnection to the DB_REPLICA or DB_PRIMARY database to query from (only “read” methods are used in either case)
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,
IReadableDatabase $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
IReadableDatabase$dbA connection to either DB_REPLICA or DB_PRIMARY (only “read” methods are used in either case)
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,
IReadableDatabase $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.
IReadableDatabase$dbconnection to DB_REPLICA or DB_PRIMARY database to query (only “read” methods are used in either case)
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

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

◆ $entitySource

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

◆ $logger

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

◆ $pageTableEntityQuery

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

◆ $repoDb

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

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