Add CentralAuth cookies to the XVO header
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 10 Apr 2008 08:42:36 +0000 (08:42 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 10 Apr 2008 08:42:36 +0000 (08:42 +0000)
includes/DefaultSettings.php
includes/OutputPage.php

index b92c012..5cd275f 100644 (file)
@@ -1501,6 +1501,9 @@ $wgCookiePath = '/';
 $wgCookieSecure = ($wgProto == 'https');
 $wgDisableCookieCheck = false;
 
+/** A list of cookies that vary the cache (for use by extensions) */
+$wgCacheVaryCookies = array();
+
 /** Override to customise the session name */
 $wgSessionName = false;
 
index 70f6f12..4440dbc 100644 (file)
@@ -544,11 +544,20 @@ class OutputPage {
        }
 
        function getCacheVaryCookies() {
-               global $wgCookiePrefix;
-               return array( 
-                       "{$wgCookiePrefix}Token",
-                       "{$wgCookiePrefix}LoggedOut",
-                       session_name() );
+               global $wgCookiePrefix, $wgCacheVaryCookies;
+               static $cookies;
+               if ( $cookies === null ) {
+                       $cookies = array_merge( 
+                               array(
+                                       "{$wgCookiePrefix}Token",
+                                       "{$wgCookiePrefix}LoggedOut",
+                                       session_name()
+                               ),
+                               $wgCacheVaryCookies
+                       );
+                       wfRunHooks('GetCacheVaryCookies', array( $this, &$cookies ) );
+               }
+               return $cookies;
        }
 
        function uncacheableBecauseRequestVars() {