diff options
author | Aleksander Machniak <alec@alec.pl> | 2015-09-01 15:08:20 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2015-09-01 15:08:20 +0300 |
commit | 67fac374a347a55049db52afe4ed1d02d84f2f18 (patch) | |
tree | 5ff8bf04f97a6ace7ed4e82e04453f99a04020cf /bin | |
parent | c4daf3f14fa34bb78fe86410bfd79bd8951d7a71 (diff) |
Fix so gc.sh script removes also expired sessions from sql database (#1490512)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gc.sh | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -24,4 +24,16 @@ 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(); |