Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-09-01 15:08:20 +0300
committerAleksander Machniak <alec@alec.pl>2015-09-01 15:08:20 +0300
commit67fac374a347a55049db52afe4ed1d02d84f2f18 (patch)
tree5ff8bf04f97a6ace7ed4e82e04453f99a04020cf /bin
parentc4daf3f14fa34bb78fe86410bfd79bd8951d7a71 (diff)
Fix so gc.sh script removes also expired sessions from sql database (#1490512)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gc.sh12
1 files changed, 12 insertions, 0 deletions
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();