From df487b2553d3b17566e9a169bcc889de84c99ea4 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 16 May 2017 15:49:03 -0700 Subject: [PATCH] ContribsPager: Use one TemplateParser instance 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. Change-Id: I59e37306c5a3216cf8ed3bfef9c80d50934a9146 --- includes/specials/pagers/ContribsPager.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index 7d303de104..ea93f1f893 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -45,6 +45,11 @@ class ContribsPager extends ReverseChronologicalPager { */ protected $mParentLens; + /** + * @var TemplateParser + */ + protected $templateParser; + function __construct( IContextSource $context, array $options ) { parent::__construct( $context ); @@ -80,6 +85,7 @@ class ContribsPager extends ReverseChronologicalPager { // queries should use a regular replica DB since the lookup pattern is not all by user. $this->mDbSecondary = wfGetDB( DB_REPLICA ); // any random replica DB $this->mDb = wfGetDB( DB_REPLICA, 'contributions' ); + $this->templateParser = new TemplateParser(); } function getDefaultQuery() { @@ -516,8 +522,7 @@ class ContribsPager extends ReverseChronologicalPager { $this->msg( 'rev-deleted-user-contribs' )->escaped(); } - $templateParser = new TemplateParser(); - $ret = $templateParser->processTemplate( + $ret = $this->templateParser->processTemplate( 'SpecialContributionsLine', $templateParams ); -- 2.20.1