Wikibase
MediaWiki Wikibase extension
Wikibase\Client\Usage\UsageLookup Interface Reference

Service interface looking up the usage of entities across pages on the local wiki. More...

+ Inheritance diagram for Wikibase\Client\Usage\UsageLookup:

Public Member Functions

 getUsagesForPage ( $pageId)
 Get the entities used on the given page. More...
 
 getPagesUsing (array $entityIds, array $aspects=[])
 Returns the pages that use any of the given entities. More...
 
 getUnusedEntities (array $entityIds)
 Returns the elements of $entityIds that are currently not used as far as this UsageTracker knows. More...
 

Detailed Description

Service interface looking up the usage of entities across pages on the local wiki.

See also
docs/usagetracking.wiki
Author
Daniel Kinzler

Member Function Documentation

◆ getPagesUsing()

Wikibase\Client\Usage\UsageLookup::getPagesUsing ( array  $entityIds,
array  $aspects = [] 
)

Returns the pages that use any of the given entities.

Parameters
EntityId[]$entityIds
string[]$aspectsWhich aspects to consider (if omitted, all aspects are considered). Use the EntityUsage::XXX_USAGE constants to represent aspects.
Returns
Traversable A traversable over PageEntityUsages of pages using any of the given entities. If $aspects is given, only usages of these aspects are included in the result.
Exceptions
UsageTrackerException

Implemented in Wikibase\Client\Usage\Sql\SqlUsageTracker, and Wikibase\Client\Usage\NullUsageTracker.

◆ getUnusedEntities()

Wikibase\Client\Usage\UsageLookup::getUnusedEntities ( array  $entityIds)

Returns the elements of $entityIds that are currently not used as far as this UsageTracker knows.

In other words, this method answers the question which of a given list of entities are currently being used on wiki pages.

Parameters
EntityId[]$entityIds
Returns
EntityId[] A list of elements of $entityIds that are unused.
Exceptions
UsageTrackerException

Implemented in Wikibase\Client\Usage\Sql\SqlUsageTracker, and Wikibase\Client\Usage\NullUsageTracker.

◆ getUsagesForPage()

Wikibase\Client\Usage\UsageLookup::getUsagesForPage (   $pageId)

Get the entities used on the given page.

Parameters
int$pageId
Returns
EntityUsage[]
Exceptions
UsageTrackerException

Implemented in Wikibase\Client\Usage\Sql\SqlUsageTracker, and Wikibase\Client\Usage\NullUsageTracker.


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