Allow session expiry time to be configured
authorTim Starling <tstarling@wikimedia.org>
Wed, 8 Aug 2012 01:20:30 +0000 (11:20 +1000)
committerTim Starling <tstarling@wikimedia.org>
Wed, 8 Aug 2012 01:20:30 +0000 (11:20 +1000)
When $wgSessionsInObjectCache is enabled, use a configurable expiry time
instead of a hard-coded one-hour expiry.

Change-Id: Ia51962176d30fd87e298c47ec347a143cad80772

RELEASE-NOTES-1.20
includes/DefaultSettings.php
includes/objectcache/ObjectCacheSessionHandler.php

index c52ff60..92e1e76 100644 (file)
@@ -111,7 +111,8 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
 * Session storage can now configured independently of general object cache 
   storage, by using $wgSessionCacheType. $wgSessionsInMemcached has been 
   renamed to $wgSessionsInObjectCache, with the old name retained for backwards
-  compatibility.
+  compatibility. When this feature is enabled, the expiry time can now be 
+  configured with $wgObjectCacheSessionExpiry.
 * Implemented mw.user.getGroups for getting and caching user groups.
 * (bug 37830) Added $wgRequirePasswordforEmailChange to control whether password
   confirmation is required for changing an email address or not.
index dda191e..55126e7 100644 (file)
@@ -1735,6 +1735,12 @@ $wgSessionsInMemcached = false;
  */
 $wgSessionsInObjectCache = false;
 
+/**
+ * The expiry time to use for session storage when $wgSessionsInObjectCache is
+ * enabled, in seconds.
+ */
+$wgObjectCacheSessionExpiry = 3600;
+
 /**
  * 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
index 3dcfa9f..e6c6881 100644 (file)
@@ -101,7 +101,8 @@ class ObjectCacheSessionHandler {
         * @return Boolean: success
         */
        static function write( $id, $data ) {
-               self::getCache()->set( self::getKey( $id ), $data, 3600 );
+               global $wgObjectCacheSessionExpiry;
+               self::getCache()->set( self::getKey( $id ), $data, $wgObjectCacheSessionExpiry );
                return true;
        }