Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\CachingCommonsMediaFileNameLookup Class Reference

Caching service that looks up normalized file names from Wikimedia Commons. More...

Public Member Functions

 __construct (MediaWikiPageNameNormalizer $mediaWikiPageNameNormalizer, BagOStuff $cache)
 
 lookupFileName ( $fileName)
 

Public Attributes

const CACHE_DURATION = 600
 

Private Member Functions

 doLookup ( $fileName)
 
 cacheResult ( $inputFileName, $actualFileName)
 
 getCacheKey ( $fileName)
 

Private Attributes

 $mediaWikiPageNameNormalizer
 
 $cache
 

Detailed Description

Caching service that looks up normalized file names from Wikimedia Commons.

Author
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\CachingCommonsMediaFileNameLookup::__construct ( MediaWikiPageNameNormalizer  $mediaWikiPageNameNormalizer,
BagOStuff  $cache 
)

Member Function Documentation

◆ cacheResult()

Wikibase\Repo\CachingCommonsMediaFileNameLookup::cacheResult (   $inputFileName,
  $actualFileName 
)
private
Parameters
string$inputFileName
string | null$actualFileName

◆ doLookup()

Wikibase\Repo\CachingCommonsMediaFileNameLookup::doLookup (   $fileName)
private
Parameters
string$fileName
Returns
string|null

◆ getCacheKey()

Wikibase\Repo\CachingCommonsMediaFileNameLookup::getCacheKey (   $fileName)
private
Parameters
string$fileName
Returns
string

◆ lookupFileName()

Wikibase\Repo\CachingCommonsMediaFileNameLookup::lookupFileName (   $fileName)
Parameters
string$fileNameFile name, without the File: prefix.
Returns
string|null The normalized file name or null if the page does not exist
Exceptions
InvalidArgumentException

Member Data Documentation

◆ $cache

Wikibase\Repo\CachingCommonsMediaFileNameLookup::$cache
private

◆ $mediaWikiPageNameNormalizer

Wikibase\Repo\CachingCommonsMediaFileNameLookup::$mediaWikiPageNameNormalizer
private

◆ CACHE_DURATION

const Wikibase\Repo\CachingCommonsMediaFileNameLookup::CACHE_DURATION = 600

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