Modernized slave wait checks in recompressTracked.php
[lhc/web/wiklou.git] / includes / TemplateParser.php
index b105ca4..3c62c14 100644 (file)
@@ -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,11 +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.
-                       try {
-                               $cache = wfGetCache( CACHE_ACCEL );
-                       } catch ( Exception $e ) {
-                               $cache = wfGetCache( CACHE_ANYTHING );
-                       }
+                       $cache = ObjectCache::newAccelerator( CACHE_ANYTHING );
                        $key = wfMemcKey( 'template', $templateName, $fastHash );
                        $code = $this->forceRecompile ? null : $cache->get( $key );
 
@@ -134,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;
        }
 
        /**
@@ -176,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',
                        )
                );
        }