From b991617bc6bac1dd0839accc3fa7c7f956a06d72 Mon Sep 17 00:00:00 2001 From: cenarium Date: Thu, 18 Feb 2016 08:17:48 +0100 Subject: [PATCH] Avoid calculating md5 when not caching references In the old caching system for references, the cache key needs the md5 of the references, but it shouldn't be calculated when one is not using this caching system. Change-Id: I83c17d1df5c5e620ea21d1bf955b86ce94bc119a --- Cite_body.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Cite_body.php b/Cite_body.php index c150821f5..e62cdfaec 100644 --- a/Cite_body.php +++ b/Cite_body.php @@ -729,15 +729,17 @@ class Cite { // We add new lines between the pieces to avoid a confused tidy (bug 13073). $parserInput = $prefix . "\n" . $content . "\n" . $suffix; - // Let's try to cache it. - global $wgMemc; - $cacheKey = wfMemcKey( 'citeref', md5( $parserInput ), $this->mParser->Title()->getArticleID() ); - wfProfileOut( __METHOD__ . '-entries' ); - global $wgCiteCacheReferences; + // Let's try to cache it. + global $wgCiteCacheReferences, $wgMemc; $data = false; if ( $wgCiteCacheReferences ) { + $cacheKey = wfMemcKey( + 'citeref', + md5( $parserInput ), + $this->mParser->Title()->getArticleID() + ); wfProfileIn( __METHOD__ . '-cache-get' ); $data = $wgMemc->get( $cacheKey ); wfProfileOut( __METHOD__ . '-cache-get' );