Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\ParserOutput\PageImagesDataUpdater Class Reference

Code to make the PageImages extension aware of pages in the Wikibase namespaces. More...

+ Inheritance diagram for Wikibase\Repo\ParserOutput\PageImagesDataUpdater:
+ Collaboration diagram for Wikibase\Repo\ParserOutput\PageImagesDataUpdater:

Public Member Functions

 __construct (array $imagePropertyIds, $pagePropName)
 
 processStatement (Statement $statement)
 
 updateParserOutput (ParserOutput $parserOutput)
 

Private Member Functions

 processSnak (Snak $snak, PropertyId $propertyId, $rank)
 
 getString (Snak $snak)
 
 isAcceptablePriority ( $propertyId)
 
 isSamePriority ( $propertyId)
 
 isAcceptableRank ( $rank)
 
 isBetterRank ( $rank)
 

Private Attributes

 $propertyPriorities
 
 $pagePropName
 
 $bestProperty
 
 $bestRank
 
 $bestFileName = null
 

Detailed Description

Code to make the PageImages extension aware of pages in the Wikibase namespaces.

The algorithm tries to find the one "best" image on an entity page, also referred to as the "lead image".

Author
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::__construct ( array $imagePropertyIds,
$pagePropName )
Parameters
string[]$imagePropertyIdsList of image property id strings, in order of preference.
string$pagePropNamePageImages page prop name

Member Function Documentation

◆ getString()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::getString ( Snak $snak)
private
Parameters
Snak$snak
Returns
string|null

◆ isAcceptablePriority()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::isAcceptablePriority ( $propertyId)
private
Parameters
string$propertyId
Returns
bool True if the property is configured as one of the image properties and it's priority is equal or better than the current best.

◆ isAcceptableRank()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::isAcceptableRank ( $rank)
private
Parameters
int$rank
Returns
bool True if the rank is not deprecated.

◆ isBetterRank()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::isBetterRank ( $rank)
private
Parameters
int$rank
Returns
bool

◆ isSamePriority()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::isSamePriority ( $propertyId)
private
Parameters
string$propertyId
Returns
bool True if the property's priority is identical to the current best.

◆ processSnak()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::processSnak ( Snak $snak,
PropertyId $propertyId,
$rank )
private
Parameters
Snak$snak
PropertyId$propertyId
int$rank

◆ processStatement()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::processStatement ( Statement $statement)
See also
StatementDataUpdater::processStatement
Parameters
Statement$statement

Implements Wikibase\Repo\ParserOutput\StatementDataUpdater.

◆ updateParserOutput()

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::updateParserOutput ( ParserOutput $parserOutput)
See also
EntityParserOutputUpdater::updateParserOutput
Parameters
ParserOutput$parserOutput

Implements Wikibase\Repo\ParserOutput\StatementDataUpdater.

Member Data Documentation

◆ $bestFileName

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::$bestFileName = null
private

◆ $bestProperty

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::$bestProperty
private

◆ $bestRank

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::$bestRank
private

◆ $pagePropName

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::$pagePropName
private

◆ $propertyPriorities

Wikibase\Repo\ParserOutput\PageImagesDataUpdater::$propertyPriorities
private

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