Cenarium has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271470

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite 
refs/changes/70/271470/1

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: newchange
Gerrit-Change-Id: I83c17d1df5c5e620ea21d1bf955b86ce94bc119a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Cenarium <[email protected]>

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

Reply via email to