EnhancedChangesList: Use one TemplateParser instance
authorKunal Mehta <legoktm@member.fsf.org>
Tue, 16 May 2017 22:43:35 +0000 (15:43 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 16 May 2017 22:43:35 +0000 (15:43 -0700)
TemplateParser has an instance cache to avoid reading from APC
repeatedly for the same template, but that only works if the code uses
the same TemplateParser object.

Noticed while investigating T163154.

Change-Id: I645895a0965f7150e9a5aebc5a7788f27aa5a26d

includes/changes/EnhancedChangesList.php

index b8a2ac8..1a2da1a 100644 (file)
@@ -32,6 +32,11 @@ class EnhancedChangesList extends ChangesList {
         */
        protected $rc_cache;
 
+       /**
+        * @var TemplateParser
+        */
+       protected $templateParser;
+
        /**
         * @param IContextSource|Skin $obj
         * @param array $filterGroups Array of ChangesListFilterGroup objects (currently optional)
@@ -58,6 +63,7 @@ class EnhancedChangesList extends ChangesList {
                        $this->message,
                        $this->linkRenderer
                );
+               $this->templateParser = new TemplateParser();
        }
 
        /**
@@ -340,8 +346,7 @@ class EnhancedChangesList extends ChangesList {
 
                $this->rcCacheIndex++;
 
-               $templateParser = new TemplateParser();
-               return $templateParser->processTemplate(
+               return $this->templateParser->processTemplate(
                        'EnhancedChangesListGroup',
                        $templateParams
                );