From 0b7e26c1bf6bc7a684eb3a214d92d3927306cd8a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Mon, 16 May 2016 02:56:42 -0400 Subject: [PATCH] Update changelog --- bin/gc.sh | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/bin/gc.sh b/bin/gc.sh index 1ee6107..cde6deb 100755 --- a/bin/gc.sh +++ b/bin/gc.sh @@ -19,9 +19,21 @@ +-----------------------------------------------------------------------+ */ -define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); +define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' ); require INSTALL_PATH.'program/include/clisetup.php'; $rcmail = rcube::get_instance(); + +$session_driver = $rcmail->config->get('session_storage', 'db'); +$session_lifetime = $rcmail->config->get('session_lifetime', 0) * 60 * 2; + +// Clean expired SQL sessions +if ($session_driver == 'db' && $session_lifetime) { + $db = $rcmail->get_dbh(); + $db->query("DELETE FROM " . $db->table_name('session') + . " WHERE changed < " . $db->now(-$session_lifetime)); +} + +// Clean caches and temp directory $rcmail->gc(); -- Gitblit v1.9.1