From 68b9b822b674e9f98025165a9391110a33f1b094 Mon Sep 17 00:00:00 2001 From: Christopher Guiney Date: Thu, 28 Jun 2012 21:53:12 -0700 Subject: Allow session garbace collection percentage to be configured. --- application/config/config.php | 2 ++ system/libraries/Session.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/application/config/config.php b/application/config/config.php index 726e3a71c..e3f87eb42 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -276,6 +276,7 @@ $config['encryption_key'] = ''; | 'sess_match_ip' = Whether to match the user's IP address when reading the session data | 'sess_match_useragent' = Whether to match the User Agent when reading the session data | 'sess_time_to_update' = how many seconds between CI refreshing Session Information +| 'gc_probability' = percent chance that stale sessions to be deleted | */ $config['sess_cookie_name'] = 'ci_session'; @@ -287,6 +288,7 @@ $config['sess_table_name'] = 'ci_sessions'; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300; +$config['gc_probability'] = 5; /* |-------------------------------------------------------------------------- diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 72a942b8a..4e5e256a1 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -201,7 +201,7 @@ class CI_Session { // Set all the session preferences, which can either be set // manually via the $params array above or via the config file - foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key) + foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key', 'gc_probability') as $key) { $this->$key = isset($params[$key]) ? $params[$key] : $this->CI->config->item($key); } -- cgit v1.2.3-24-g4f1b