Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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 (int $pageId)
 Get the entities used on the given page.
 
 getPagesUsing (array $entityIds, array $aspects=[])
 Returns the pages that use any of the given entities.
 
 getUnusedEntities (array $entityIds)
 Returns the elements of $entityIds that are currently not used as far as this UsageTracker knows.
 

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.

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

◆ 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.

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

◆ getUsagesForPage()

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

Get the entities used on the given page.

The returned array uses the identity string as the key, so that a specific usage can be found quickly.

Parameters
int$pageId
Returns
EntityUsage[] keyed by identity string

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


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