Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -544,11 +544,20 @@ |
545 | 545 | } |
546 | 546 | |
547 | 547 | function getCacheVaryCookies() { |
548 | | - global $wgCookiePrefix; |
549 | | - return array( |
550 | | - "{$wgCookiePrefix}Token", |
551 | | - "{$wgCookiePrefix}LoggedOut", |
552 | | - session_name() ); |
| 548 | + global $wgCookiePrefix, $wgCacheVaryCookies; |
| 549 | + static $cookies; |
| 550 | + if ( $cookies === null ) { |
| 551 | + $cookies = array_merge( |
| 552 | + array( |
| 553 | + "{$wgCookiePrefix}Token", |
| 554 | + "{$wgCookiePrefix}LoggedOut", |
| 555 | + session_name() |
| 556 | + ), |
| 557 | + $wgCacheVaryCookies |
| 558 | + ); |
| 559 | + wfRunHooks('GetCacheVaryCookies', array( $this, &$cookies ) ); |
| 560 | + } |
| 561 | + return $cookies; |
553 | 562 | } |
554 | 563 | |
555 | 564 | function uncacheableBecauseRequestVars() { |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1501,6 +1501,9 @@ |
1502 | 1502 | $wgCookieSecure = ($wgProto == 'https'); |
1503 | 1503 | $wgDisableCookieCheck = false; |
1504 | 1504 | |
| 1505 | +/** A list of cookies that vary the cache (for use by extensions) */ |
| 1506 | +$wgCacheVaryCookies = array(); |
| 1507 | + |
1505 | 1508 | /** Override to customise the session name */ |
1506 | 1509 | $wgSessionName = false; |
1507 | 1510 | |
Index: trunk/extensions/CentralAuth/CentralAuth.php |
— | — | @@ -84,6 +84,7 @@ |
85 | 85 | $wgHooks['AutoAuthenticate'][] = 'wfCentralAuthAutoAuthenticate'; |
86 | 86 | $wgHooks['UserLogout'][] = 'wfCentralAuthLogout'; |
87 | 87 | $wgHooks['UserLogoutComplete'][] = 'wfCentralAuthLogoutComplete'; |
| 88 | +$wgHooks['GetCacheVaryCookies'][] = 'wfCentralAuthGetCacheVaryCookies'; |
88 | 89 | |
89 | 90 | // For interaction with the Special:Renameuser extension |
90 | 91 | $wgHooks['RenameUserAbort'][] = 'wfCentralAuthRenameUserAbort'; |
— | — | @@ -324,4 +325,11 @@ |
325 | 326 | |
326 | 327 | $inject_html .= Xml::closeElement( 'p' ); |
327 | 328 | return true; |
328 | | -} |
\ No newline at end of file |
| 329 | +} |
| 330 | + |
| 331 | +function wfCentralAuthGetCacheVaryCookies( $out, &$cookies ) { |
| 332 | + global $wgCentralAuthCookiePrefix; |
| 333 | + $cookies[] = $wgCentralAuthCookiePrefix . 'Token'; |
| 334 | + $cookies[] = $wgCentralAuthCookiePrefix . 'Session'; |
| 335 | + return true; |
| 336 | +} |