diff options
author | Timo Tijhof <krinklemail@gmail.com> | 2015-10-22 00:55:10 +0100 |
---|---|---|
committer | Timo Tijhof <krinklemail@gmail.com> | 2015-10-22 00:55:10 +0100 |
commit | f0d53506cf87e06f1b5fdd8760cf3ed6045b6a37 (patch) | |
tree | 2ab48cb19f4740e3c4192598b7490457c4d8fdb9 /includes/TemplateParser.php | |
parent | 7662212384f3e6eb7bff70c2a4108e4839395e62 (diff) | |
download | mediawikicore-f0d53506cf87e06f1b5fdd8760cf3ed6045b6a37.tar.gz mediawikicore-f0d53506cf87e06f1b5fdd8760cf3ed6045b6a37.zip |
TemplateParser: Use context makeKey() instead of wfMemcKey()
Also:
* Use ternary shorthand.
* Remove verbose comment about APC fallback. APC always requires
a fallback and is enforced by the method being called. Stating
the obvious is confusing here.
Change-Id: Ie5cb3bdc60600806b01b57f1f1b352b981818b0d
Diffstat (limited to 'includes/TemplateParser.php')
-rw-r--r-- | includes/TemplateParser.php | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php index 3c62c1400284..44d264dec9c3 100644 --- a/includes/TemplateParser.php +++ b/includes/TemplateParser.php @@ -41,7 +41,7 @@ class TemplateParser { * @param boolean $forceRecompile */ public function __construct( $templateDir = null, $forceRecompile = false ) { - $this->templateDir = $templateDir ? $templateDir : __DIR__ . '/templates'; + $this->templateDir = $templateDir ?: __DIR__ . '/templates'; $this->forceRecompile = $forceRecompile; } @@ -49,7 +49,7 @@ class TemplateParser { * Constructs the location of the the source Mustache template * @param string $templateName The name of the template * @return string - * @throws UnexpectedValueException Disallows upwards directory traversal via $templateName + * @throws UnexpectedValueException If $templateName attempts upwards directory traversal */ protected function getTemplateFilename( $templateName ) { // Prevent upwards directory traversal using same methods as Title::secureAndSplit @@ -103,10 +103,8 @@ class TemplateParser { if ( $secretKey ) { // See if the compiled PHP code is stored in cache. - // CACHE_ACCEL throws an exception if no suitable object cache is present, so fall - // back to CACHE_ANYTHING. $cache = ObjectCache::newAccelerator( CACHE_ANYTHING ); - $key = wfMemcKey( 'template', $templateName, $fastHash ); + $key = $cache->makeKey( 'template', $templateName, $fastHash ); $code = $this->forceRecompile ? null : $cache->get( $key ); if ( !$code ) { |