aboutsummaryrefslogtreecommitdiffstats
path: root/includes/parser/Preprocessor.php
diff options
context:
space:
mode:
authorKevin Israel <pleasestand@live.com>2015-10-25 21:29:47 -0400
committerKevin Israel <pleasestand@live.com>2015-10-25 21:29:47 -0400
commit23ae30d61cca3148451d0b1971d2d466fb6aebad (patch)
treeb1c17056ae7785f1fbe9464a0b0780818a7cc849 /includes/parser/Preprocessor.php
parentf63f44d2d3e2b1877c1b79d1393908e80b6fef2f (diff)
downloadmediawikicore-23ae30d61cca3148451d0b1971d2d466fb6aebad.tar.gz
mediawikicore-23ae30d61cca3148451d0b1971d2d466fb6aebad.zip
Preprocessor: Use correct cache prefix for the subclass
Follows-up 1559be9f7aef, which caused "Preprocessor" to be used as the cache prefix for all subclasses, by using late static binding to access the constant. Though use of that feature has been discouraged[1], this change is a straightforward bug fix, and any improvements can be made separately. [1]: https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Late_static_binding Change-Id: Ib25e1908a6373f6675659a0906e12d4a38af014c
Diffstat (limited to 'includes/parser/Preprocessor.php')
-rw-r--r--includes/parser/Preprocessor.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php
index 30eab19a57bb..b1e49b2a6f9d 100644
--- a/includes/parser/Preprocessor.php
+++ b/includes/parser/Preprocessor.php
@@ -46,9 +46,11 @@ abstract class Preprocessor {
}
$key = wfMemcKey(
- defined( 'self::CACHE_PREFIX' ) ? self::CACHE_PREFIX : __CLASS__,
+ // 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(),
md5( $text ), $flags );
- $value = sprintf( "%08d", self::CACHE_VERSION ) . $tree;
+ $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree;
$cache = ObjectCache::getInstance( $config->get( 'MainCacheType' ) );
$cache->set( $key, $value, 86400 );
@@ -77,7 +79,9 @@ abstract class Preprocessor {
$cache = ObjectCache::getInstance( $config->get( 'MainCacheType' ) );
$key = wfMemcKey(
- defined( 'self::CACHE_PREFIX' ) ? self::CACHE_PREFIX : __CLASS__,
+ // 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(),
md5( $text ), $flags );
$value = $cache->get( $key );
@@ -86,7 +90,7 @@ abstract class Preprocessor {
}
$version = intval( substr( $value, 0, 8 ) );
- if ( $version !== self::CACHE_VERSION ) {
+ if ( $version !== static::CACHE_VERSION ) {
return false;
}