jenkins-bot has submitted this change and it was merged.

Change subject: Avoid calculating md5 when not caching references
......................................................................


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
---
M Cite_body.php
1 file changed, 7 insertions(+), 5 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Cite_body.php b/Cite_body.php
index c150821..e62cdfa 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -729,15 +729,17 @@
                // 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' );

-- 
To view, visit https://gerrit.wikimedia.org/r/271470
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I83c17d1df5c5e620ea21d1bf955b86ce94bc119a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Cenarium <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to