54 'names' => [ 2 => null ],
60 'names' => [ 2 => null ],
74 $config = RequestContext::getMain()->getConfig();
76 $length = strlen( $text );
77 $threshold = $config->get(
'PreprocessorCacheThreshold' );
78 if ( $threshold ===
false || $length < $threshold || $length > 1e6 ) {
82 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
85 defined(
'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
89 $value = sprintf(
"%08d", static::CACHE_VERSION ) . $tree;
91 $cache->set( $key, $value, 86400 );
93 LoggerFactory::getInstance(
'Preprocessor' )
94 ->info(
"Cached preprocessor output (key: $key)" );
106 $config = RequestContext::getMain()->getConfig();
108 $length = strlen( $text );
109 $threshold = $config->get(
'PreprocessorCacheThreshold' );
110 if ( $threshold ===
false || $length < $threshold || $length > 1e6 ) {
114 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
118 defined(
'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
123 $value =
$cache->get( $key );
128 $version = intval( substr( $value, 0, 8 ) );
129 if ( $version !== static::CACHE_VERSION ) {
133 LoggerFactory::getInstance(
'Preprocessor' )
134 ->info(
"Loaded preprocessor output from cache (key: $key)" );
136 return substr( $value, 8 );
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
preprocessToObj( $text, $flags=0)
Preprocess text to a PPNode.
cacheGetTree( $text, $flags)
Attempt to load a precomputed document tree for some given wikitext from the cache.
array $rules
Brace matching rules.
newPartNodeArray( $values)
Create a new custom node for programmatic use of parameter replacement as used in some extensions.
cacheSetTree( $text, $flags, $tree)
Store a document tree in the cache.
newFrame()
Create a new top-level frame for expansion of a page.
newCustomFrame( $args)
Create a new custom frame for programmatic use of parameter replacement as used in some extensions.