r40937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40936‎ | r40937 | r40938 >
Date:21:14, 16 September 2008
Author:brion
Status:old
Tags:
Comment:
* (bug 10463) Apply $wgRenderHashAppend to sitenotice cache keys so SSL and non-SSL sites get separate notice caches.

This seems to be a little funny, though, at least on commons -- the commonswiki:sitenotice:https=1 key is just storing 'false' so it presumably gets reparsed on each run. I can't see any way that this should be happening, which is a little intimidating...
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1741,7 +1741,7 @@
17421742 }
17431743
17441744 function wfGetCachedNotice( $name ) {
1745 - global $wgOut, $parserMemc;
 1745+ global $wgOut, $wgRenderHashAppend, $parserMemc;
17461746 $fname = 'wfGetCachedNotice';
17471747 wfProfileIn( $fname );
17481748
@@ -1763,7 +1763,9 @@
17641764 }
17651765 }
17661766
1767 - $cachedNotice = $parserMemc->get( wfMemcKey( $name ) );
 1767+ // Use the extra hash appender to let eg SSL variants separately cache.
 1768+ $key = wfMemcKey( $name . $wgRenderHashAppend );
 1769+ $cachedNotice = $parserMemc->get( $key );
17681770 if( is_array( $cachedNotice ) ) {
17691771 if( md5( $notice ) == $cachedNotice['hash'] ) {
17701772 $notice = $cachedNotice['html'];
@@ -1777,7 +1779,7 @@
17781780 if( $needParse ) {
17791781 if( is_object( $wgOut ) ) {
17801782 $parsed = $wgOut->parse( $notice );
1781 - $parserMemc->set( wfMemcKey( $name ), array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
 1783+ $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
17821784 $notice = $parsed;
17831785 } else {
17841786 wfDebug( 'wfGetCachedNotice called for ' . $name . ' with no $wgOut available' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r40962Fix for r40937 (and per talk with brion): merge the RenderHash extension in coreialex18:36, 17 September 2008