MediaWiki REL1_34
MediaWiki\BadFileLookup Class Reference
Collaboration diagram for MediaWiki\BadFileLookup:

Public Member Functions

 __construct (callable $blacklistCallback, BagOStuff $cache, RepoGroup $repoGroup, TitleParser $titleParser)
 Do not call directly.
 
 isBadFile ( $name, LinkTarget $contextTitle=null)
 Determine if a file exists on the 'bad image list'.
 

Private Attributes

array null $badFiles
 Parsed blacklist.
 
callable $blacklistCallback
 Returns contents of blacklist (see comment for isBadFile())
 
BagOStuff $cache
 Cache of parsed bad image list.
 
RepoGroup $repoGroup
 
TitleParser $titleParser
 

Detailed Description

Definition at line 12 of file BadFileLookup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\BadFileLookup::__construct ( callable  $blacklistCallback,
BagOStuff  $cache,
RepoGroup  $repoGroup,
TitleParser  $titleParser 
)

Do not call directly.

Use MediaWikiServices.

Parameters
callable$blacklistCallbackCallback that returns wikitext of a file blacklist
BagOStuff$cacheFor caching parsed versions of the blacklist
RepoGroup$repoGroup
TitleParser$titleParser

Definition at line 36 of file BadFileLookup.php.

References $cache.

Member Function Documentation

◆ isBadFile()

MediaWiki\BadFileLookup::isBadFile (   $name,
LinkTarget  $contextTitle = null 
)

Determine if a file exists on the 'bad image list'.

The format of MediaWiki:Bad_image_list is as follows:

  • Only list items (lines starting with "*") are considered
  • The first link on a line must be a link to a bad file
  • Any subsequent links on the same line are considered to be exceptions, i.e. articles where the file may occur inline.
Parameters
string$nameThe file name to check
LinkTarget | null$contextTitleThe page on which the file occurs, if known
Returns
bool

Definition at line 61 of file BadFileLookup.php.

References $file, $line, $lines, and $title.

Member Data Documentation

◆ $badFiles

array null MediaWiki\BadFileLookup::$badFiles
private

Parsed blacklist.

Definition at line 26 of file BadFileLookup.php.

◆ $blacklistCallback

callable MediaWiki\BadFileLookup::$blacklistCallback
private

Returns contents of blacklist (see comment for isBadFile())

Definition at line 14 of file BadFileLookup.php.

◆ $cache

BagOStuff MediaWiki\BadFileLookup::$cache
private

Cache of parsed bad image list.

Definition at line 17 of file BadFileLookup.php.

◆ $repoGroup

RepoGroup MediaWiki\BadFileLookup::$repoGroup
private

Definition at line 20 of file BadFileLookup.php.

◆ $titleParser

TitleParser MediaWiki\BadFileLookup::$titleParser
private

Definition at line 23 of file BadFileLookup.php.


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