diff --git a/CHANGELOG b/CHANGELOG index fdb507d04..482e924d1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -53,6 +53,7 @@ CHANGELOG Roundcube Webmail - Fix so css of one html part does not apply to other text parts on message display (#1490505) - Fix handling of plus character in mailto: links (#1490510) - Fix so adding CC/BCC recipients from the sidebar unhides compose form fields in Classic skin (#1490472) +- Fix so gc.sh script removes also expired sessions from sql database (#1490512) RELEASE 1.1.2 ------------- diff --git a/bin/gc.sh b/bin/gc.sh index e0d722a18..cde6debfb 100755 --- a/bin/gc.sh +++ b/bin/gc.sh @@ -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();