X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FPreprocessor.php;h=368d79ef4993ca245a1e072500c1f0cc6887ccae;hp=b1e49b2a6f9d6a253cdf6b3209514dba95e5eb38;hb=e3bd13db0c285f312e31bb1b7271af4628cca80c;hpb=f796dbb59df851dca0d71de72d4a136cd716ece7 diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php index b1e49b2a6f..368d79ef49 100644 --- a/includes/parser/Preprocessor.php +++ b/includes/parser/Preprocessor.php @@ -30,6 +30,27 @@ abstract class Preprocessor { const CACHE_VERSION = 1; + /** + * @var array Brace matching rules. + */ + protected $rules = [ + '{' => [ + 'end' => '}', + 'names' => [ + 2 => 'template', + 3 => 'tplarg', + ], + 'min' => 2, + 'max' => 3, + ], + '[' => [ + 'end' => ']', + 'names' => [ 2 => null ], + 'min' => 2, + 'max' => 2, + ] + ]; + /** * Store a document tree in the cache. * @@ -46,9 +67,7 @@ abstract class Preprocessor { } $key = wfMemcKey( - // TODO: Once we require PHP 5.5, use static::class instead of - // get_called_class() or get_class( $this ). - defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : get_called_class(), + defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class, md5( $text ), $flags ); $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree; @@ -79,9 +98,7 @@ abstract class Preprocessor { $cache = ObjectCache::getInstance( $config->get( 'MainCacheType' ) ); $key = wfMemcKey( - // TODO: Once we require PHP 5.5, use static::class instead of - // get_called_class() or get_class( $this ). - defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : get_called_class(), + defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class, md5( $text ), $flags ); $value = $cache->get( $key );