* (bug 10463) Apply $wgRenderHashAppend to sitenotice cache keys so SSL and non-SSL...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 16 Sep 2008 21:14:25 +0000 (21:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 16 Sep 2008 21:14:25 +0000 (21:14 +0000)
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...

includes/GlobalFunctions.php

index e6aca47..44d3512 100644 (file)
@@ -1741,7 +1741,7 @@ function swap( &$x, &$y ) {
 }
 
 function wfGetCachedNotice( $name ) {
-       global $wgOut, $parserMemc;
+       global $wgOut, $wgRenderHashAppend, $parserMemc;
        $fname = 'wfGetCachedNotice';
        wfProfileIn( $fname );
 
@@ -1763,7 +1763,9 @@ function wfGetCachedNotice( $name ) {
                }
        }
 
-       $cachedNotice = $parserMemc->get( wfMemcKey( $name ) );
+       // Use the extra hash appender to let eg SSL variants separately cache.
+       $key = wfMemcKey( $name . $wgRenderHashAppend );
+       $cachedNotice = $parserMemc->get( $key );
        if( is_array( $cachedNotice ) ) {
                if( md5( $notice ) == $cachedNotice['hash'] ) {
                        $notice = $cachedNotice['html'];
@@ -1777,7 +1779,7 @@ function wfGetCachedNotice( $name ) {
        if( $needParse ) {
                if( is_object( $wgOut ) ) {
                        $parsed = $wgOut->parse( $notice );
-                       $parserMemc->set( wfMemcKey( $name ), array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
+                       $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
                        $notice = $parsed;
                } else {
                        wfDebug( 'wfGetCachedNotice called for ' . $name . ' with no $wgOut available' );