MediaWiki REL1_39
TrackingCategories Class Reference

This class performs some operations related to tracking categories, such as creating a list of all such categories. More...

Public Member Functions

 __construct (ServiceOptions $options, NamespaceInfo $namespaceInfo, TitleParser $titleParser, LoggerInterface $logger)
 
 addTrackingCategory (ParserOutput $parserOutput, string $msg, ?PageReference $contextPage)
 Add a tracking category to a ParserOutput.
 
 getTrackingCategories ()
 Read the global and extract title objects from the corresponding messages.
 
 resolveTrackingCategory (string $msg, ?PageReference $contextPage)
 Resolve a tracking category.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

This class performs some operations related to tracking categories, such as creating a list of all such categories.

Since
1.29

Definition at line 33 of file TrackingCategories.php.

Constructor & Destructor Documentation

◆ __construct()

TrackingCategories::__construct ( ServiceOptions  $options,
NamespaceInfo  $namespaceInfo,
TitleParser  $titleParser,
LoggerInterface  $logger 
)
Parameters
ServiceOptions$options
NamespaceInfo$namespaceInfo
TitleParser$titleParser
LoggerInterface$logger

Definition at line 91 of file TrackingCategories.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ addTrackingCategory()

TrackingCategories::addTrackingCategory ( ParserOutput  $parserOutput,
string  $msg,
?PageReference  $contextPage 
)

Add a tracking category to a ParserOutput.

Parameters
ParserOutput$parserOutput
string$msgMessage key
?PageReference$contextPage Context page title
Returns
bool Whether the addition was successful
Since
1.38

Definition at line 239 of file TrackingCategories.php.

◆ getTrackingCategories()

TrackingCategories::getTrackingCategories ( )

Read the global and extract title objects from the corresponding messages.

TODO consider renaming this method, since this class is retrieved from MediaWikiServices, resulting in calls like: MediaWikiServices::getInstance()->getTrackingCategories()->getTrackingCategories()

Returns
array[] [ 'msg' => Title, 'cats' => Title[] ]

Definition at line 117 of file TrackingCategories.php.

References NS_CATEGORY, NS_MEDIAWIKI, and wfMessage().

◆ resolveTrackingCategory()

TrackingCategories::resolveTrackingCategory ( string  $msg,
?PageReference  $contextPage 
)

Resolve a tracking category.

Parameters
string$msgMessage key
?PageReference$contextPage Context page title
Returns
?LinkTarget the proper category page, or null if the tracking category is disabled or unsafe
Since
1.38

Definition at line 200 of file TrackingCategories.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const TrackingCategories::CONSTRUCTOR_OPTIONS
Initial value:
= [
MainConfigNames::TrackingCategories,
MainConfigNames::EnableMagicLinks,
]
Access: internal
For use by ServiceWiring

Definition at line 38 of file TrackingCategories.php.


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