X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FTemplateParser.php;h=3c62c14002843040dfc85528a225b1263ca778d5;hb=4c4325e98cc7e8b7c4321e36fa03975ed8ec4265;hp=3de70fa2a21b34c197a9d0a7e03a04bb18b5cd64;hpb=257d7ff0cb7739ea4e0fb392bd4f5ea3285c03fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php index 3de70fa2a2..3c62c14002 100644 --- a/includes/TemplateParser.php +++ b/includes/TemplateParser.php @@ -79,7 +79,9 @@ class TemplateParser { */ protected function getTemplate( $templateName ) { // If a renderer has already been defined for this template, reuse it - if ( isset( $this->renderers[$templateName] ) && is_callable( $this->renderers[$templateName] ) ) { + if ( isset( $this->renderers[$templateName] ) && + is_callable( $this->renderers[$templateName] ) + ) { return $this->renderers[$templateName]; } @@ -103,7 +105,7 @@ class TemplateParser { // 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( array(), CACHE_ANYTHING ); + $cache = ObjectCache::newAccelerator( CACHE_ANYTHING ); $key = wfMemcKey( 'template', $templateName, $fastHash ); $code = $this->forceRecompile ? null : $cache->get( $key ); @@ -130,7 +132,8 @@ class TemplateParser { if ( !is_callable( $renderer ) ) { throw new RuntimeException( "Requested template, {$templateName}, is not callable" ); } - return $this->renderers[$templateName] = $renderer; + $this->renderers[$templateName] = $renderer; + return $renderer; } /** @@ -172,7 +175,9 @@ class TemplateParser { array( // Do not add more flags here without discussion. // If you do add more flags, be sure to update unit tests as well. - 'flags' => LightnCandy::FLAG_ERROR_EXCEPTION + 'flags' => LightnCandy::FLAG_ERROR_EXCEPTION, + 'basedir' => $this->templateDir, + 'fileext' => '.mustache', ) ); }