From: Tim Starling Date: Wed, 8 Aug 2012 01:20:30 +0000 (+1000) Subject: Allow session expiry time to be configured X-Git-Tag: 1.31.0-rc.0~22758^2~1 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=3b0132a64923ac8f64f072d6a9e5a02e89b44e10;p=lhc%2Fweb%2Fwiklou.git Allow session expiry time to be configured When $wgSessionsInObjectCache is enabled, use a configurable expiry time instead of a hard-coded one-hour expiry. Change-Id: Ia51962176d30fd87e298c47ec347a143cad80772 --- diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index c52ff60970..92e1e765aa 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -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. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index dda191e4f1..55126e7695 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/includes/objectcache/ObjectCacheSessionHandler.php b/includes/objectcache/ObjectCacheSessionHandler.php index 3dcfa9f690..e6c68818a4 100644 --- a/includes/objectcache/ObjectCacheSessionHandler.php +++ b/includes/objectcache/ObjectCacheSessionHandler.php @@ -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; }