LinkTitles extension for MediaWiki
Automatically add links to existing pages.
LinkTitles\Targets Class Reference

Fetches potential target page titles from the database. More...

Static Public Member Functions

static singleton (\Title $title, Config $config)
 Singleton factory that returns a (cached) database query results with potential target page titles. More...
 
static invalidate ()
 Invalidates the cache; the next call of Targets::singleton() will trigger a database query. More...
 

Public Attributes

 $queryResult
 Holds the results of a database query for target page titles, filtered and sorted.
 
 $sourceNamespace
 Holds the source page's namespace (integer) for which the list of target pages was built.
 

Private Member Functions

 __construct (\Title $title, Config $config)
 The constructor is private to enforce using the singleton pattern. More...
 
 fetch ()
 Fetches the page titles from the database.
 
 charLength ()
 

Private Attributes

 $config
 
 $charLengthFunction
 Stores the CHAR_LENGTH function to be used with the database connection.
 

Static Private Attributes

static $instance
 

Detailed Description

Fetches potential target page titles from the database.

Definition at line 29 of file Targets.php.

Constructor & Destructor Documentation

LinkTitles\Targets::__construct ( \Title  $title,
Config  $config 
)
private

The constructor is private to enforce using the singleton pattern.

Parameters
\Title$title

Definition at line 87 of file Targets.php.

Member Function Documentation

static LinkTitles\Targets::invalidate ( )
static

Invalidates the cache; the next call of Targets::singleton() will trigger a database query.

Use this in unit tests which are performed in a single request cycle so that changes to the pages list may not be picked up by the cached Targets instance.

Definition at line 57 of file Targets.php.

static LinkTitles\Targets::singleton ( \Title  $title,
Config  $config 
)
static

Singleton factory that returns a (cached) database query results with potential target page titles.

The subset of pages that may serve as target pages depends on the namespace of the source page. Therefore, if the $sourceNamespace differs from the cached namespace, the database is queried again.

Parameters
String$sourceNamespaceThe namespace of the current page.
Config$configLinkTitles configuration.

Definition at line 43 of file Targets.php.


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