(bugs 11381, 11613) Session.save_handler issues:
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 10 Apr 2009 14:53:32 +0000 (14:53 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 10 Apr 2009 14:53:32 +0000 (14:53 +0000)
* Added a new config variable, $wgSessionHandler to control what value the save_handler is set to
* Setting to null allows you to disable setting it entirely, which was the primary complaint of the two bugs, but it also allows you to set it to whatever you'd like

RELEASE-NOTES
includes/DefaultSettings.php
includes/GlobalFunctions.php

index 0c5f2a7..b9dd86a 100644 (file)
@@ -31,6 +31,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add $wgExportFromNamespaces for enabling/disabling the "export all from 
   namespace" option (disabled by default)
 * (bug 18222) $wgMinimalPasswordLength default is now 1
+* $wgSessionHandler can be used to configure session.save_handler
 
 === New features in 1.15 ===
 
@@ -335,6 +336,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 12998) Allow <sup>, <sub>, etc. in DISPLAYTITLE
 * (bug 1553) Lowercase navigation headings in German
 * (bug 7830) Pending transactions failed to commit on loginToUse() error
+* (bug 11613) session.save_handler being over-ridden
+* (bug 11381) session.save_handler being set twice (causes error)
 
 == API changes in 1.15 ==
 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
index 8fd4508..74f5d5c 100644 (file)
@@ -736,6 +736,12 @@ $wgParserCacheExpireTime = 86400;
 
 $wgSessionsInMemcached = false;
 
+/** This is used for setting php's session.save_handler. In practice, you will
+ * almost never need to change this ever. Other options might be 'user' or 
+ * 'session_mysql.' Setting to null skips setting this entirely (which might be
+ * useful if you're doing cross-application sessions, see bug 11381) */
+$wgSessionHandler = 'files';
+
 /**@{
  * Memcached-specific settings
  * See docs/memcached.txt
index 4668652..2ca81c9 100644 (file)
@@ -2708,13 +2708,14 @@ function wfHttpOnlySafe() {
  * Initialise php session
  */
 function wfSetupSession() {
-       global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly;
+       global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain, 
+                       $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
        if( $wgSessionsInMemcached ) {
                require_once( 'MemcachedSessions.php' );
-       } elseif( 'files' != ini_get( 'session.save_handler' ) ) {
-               # If it's left on 'user' or another setting from another
-               # application, it will end up failing. Try to recover.
-               ini_set ( 'session.save_handler', 'files' );
+       } elseif( $wgSessionHandler && $wgSessionHandler != ini_get( 'session.save_handler' ) ) {
+               # Only set this if $wgSessionHandler isn't null and session.save_handler
+               # hasn't already been set to the desired value (that causes errors)
+               ini_set ( 'session.save_handler', $wgSessionHandler );
        }
        $httpOnlySafe = wfHttpOnlySafe();
        wfDebugLog( 'cookie',