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
This commit is contained in:
cenarium 2016-02-18 08:17:48 +01:00
parent 0a77a3d2a3
commit b991617bc6

View file

@ -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' );