MediaWiki master
MediaWiki\Parser\CoreMagicVariables Class Reference

Expansions of core magic variables, used by the parser. More...

Static Public Member Functions

static applyCacheExpiry (Parser $parser, int $ttl, ?int $stagger=null)
 Apply the given $ttl to the cache expiry of the parser output, adjusting slightly to ensure a minimum TTL and avoid cache stampede.
 
static applyUnitTimestampDeadline (Parser $parser, ?ConvertibleTimestamp $ts, string $unit)
 Adjust the cache expiry to account for a dynamic timestamp displayed in output.
 
static expand (Parser $parser, string $id, ConvertibleTimestamp $ts, ServiceOptions $svcOptions, LoggerInterface $logger)
 Expand the magic variable given by $index.
 

Detailed Description

Expansions of core magic variables, used by the parser.

Access: internal

Definition at line 26 of file CoreMagicVariables.php.

Member Function Documentation

◆ applyCacheExpiry()

static MediaWiki\Parser\CoreMagicVariables::applyCacheExpiry ( Parser $parser,
int $ttl,
?int $stagger = null )
static

Apply the given $ttl to the cache expiry of the parser output, adjusting slightly to ensure a minimum TTL and avoid cache stampede.

Parameters
Parser$parser
int$ttlThe desired time-to-live, in seconds
?int$staggerAn optional random value used to avoid stampede

Definition at line 344 of file CoreMagicVariables.php.

◆ applyUnitTimestampDeadline()

static MediaWiki\Parser\CoreMagicVariables::applyUnitTimestampDeadline ( Parser $parser,
?ConvertibleTimestamp $ts,
string $unit )
static

Adjust the cache expiry to account for a dynamic timestamp displayed in output.

Parameters
Parser$parser
?ConvertibleTimestamp$tsCurrent timestamp with the display timezone. If missing (null) the timestamp will be fetched from the ParserOptions.
string$unitThe unit the timestamp is expressed in; one of ("Y", "M", "D", "H")

Definition at line 326 of file CoreMagicVariables.php.

◆ expand()

static MediaWiki\Parser\CoreMagicVariables::expand ( Parser $parser,
string $id,
ConvertibleTimestamp $ts,
ServiceOptions $svcOptions,
LoggerInterface $logger )
static

Expand the magic variable given by $index.

Access: internal
Parameters
Parser$parser
string$idThe name of the variable, and equivalently, the magic word ID which was used to match the variable
ConvertibleTimestamp$tsTimestamp to use when expanding magic variable
ServiceOptions$svcOptionsService options for the parser
LoggerInterface$logger
Returns
string|null The expanded value, as wikitext, or null to indicate the given index wasn't a known magic variable.

Definition at line 66 of file CoreMagicVariables.php.

References MediaWiki\Parser\Parser\getOutput().


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