diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-07-01 22:42:41 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-07-01 22:42:41 +0200 |
commit | 3da427e94bb5f4d0d609cd4b868b2796e5e50a65 (patch) | |
tree | d3a41bb1c8586f4876b6a4b4808d5edbbd1ffe0d /system/libraries | |
parent | 7db0f597c78cd5485b566d9cd6e3935a8489c540 (diff) | |
parent | c254792b02cccebb10993feed58fb9ed63a28ebc (diff) |
Merge pull request #1549 from chrisguiney/session_gc
Allow session garbace collection percentage to be configured.
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Session.php | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 72a942b8a..af38dc366 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -155,12 +155,6 @@ class CI_Session { */ public $time_reference = 'local'; - /** - * Probablity level of garbage collection of old sessions - * - * @var int - */ - public $gc_probability = 5; /** * Session data @@ -940,8 +934,11 @@ class CI_Session { return; } + $probability = ini_get('session.gc_probability'); + $divisor = ini_get('session.gc_divisor'); + srand(time()); - if ((rand() % 100) < $this->gc_probability) + if ((mt_rand(0, $divisor) / $divisor) < $probability) { $expire = $this->now - $this->sess_expiration; |