r33064 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33063‎ | r33064 | r33065 >
Date:08:42, 10 April 2008
Author:tstarling
Status:old
Tags:
Comment:
Add CentralAuth cookies to the XVO header
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuth.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -544,11 +544,20 @@
545545 }
546546
547547 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;
553562 }
554563
555564 function uncacheableBecauseRequestVars() {
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1501,6 +1501,9 @@
15021502 $wgCookieSecure = ($wgProto == 'https');
15031503 $wgDisableCookieCheck = false;
15041504
 1505+/** A list of cookies that vary the cache (for use by extensions) */
 1506+$wgCacheVaryCookies = array();
 1507+
15051508 /** Override to customise the session name */
15061509 $wgSessionName = false;
15071510
Index: trunk/extensions/CentralAuth/CentralAuth.php
@@ -84,6 +84,7 @@
8585 $wgHooks['AutoAuthenticate'][] = 'wfCentralAuthAutoAuthenticate';
8686 $wgHooks['UserLogout'][] = 'wfCentralAuthLogout';
8787 $wgHooks['UserLogoutComplete'][] = 'wfCentralAuthLogoutComplete';
 88+$wgHooks['GetCacheVaryCookies'][] = 'wfCentralAuthGetCacheVaryCookies';
8889
8990 // For interaction with the Special:Renameuser extension
9091 $wgHooks['RenameUserAbort'][] = 'wfCentralAuthRenameUserAbort';
@@ -324,4 +325,11 @@
325326
326327 $inject_html .= Xml::closeElement( 'p' );
327328 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+}

Status & tagging log