bin/gc.sh | ●●●●● patch | view | raw | blame | history | |
config/main.inc.php.dist | ●●●●● patch | view | raw | blame | history | |
program/include/rcmail.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube_session.php | ●●●●● patch | view | raw | blame | history |
bin/gc.sh
New file @@ -0,0 +1,28 @@ #!/usr/bin/env php <?php /* +-----------------------------------------------------------------------+ | bin/gc.sh | | | | This file is part of the Roundcube Webmail client | | Copyright (C) 2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | | See the README file for a full license statement. | | | | PURPOSE: | | Trigger garbage collecting routines manually (e.g. via cronjob) | | | +-----------------------------------------------------------------------+ | Author: Thomas Bruederli <roundcube@gmail.com> | +-----------------------------------------------------------------------+ */ define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); require INSTALL_PATH.'program/include/clisetup.php'; $rcmail = rcube::get_instance(); $rcmail->temp_gc(); $rcmail->cache_gc(); config/main.inc.php.dist
@@ -254,9 +254,10 @@ // Session path. Defaults to PHP session.cookie_path setting. $rcmail_config['session_path'] = null; // Backend to use for session storage. Can either be 'db' (default) or 'memcache' // If set to memcache, a list of servers need to be specified in 'memcache_hosts' // Backend to use for session storage. Can either be 'db' (default), 'memcache' or 'php' // If set to 'memcache', a list of servers need to be specified in 'memcache_hosts' // Make sure the Memcache extension (http://pecl.php.net/package/memcache) version >= 2.0.0 is installed // Setting this value to 'php' will use the default session save handler configured in PHP $rcmail_config['session_storage'] = 'db'; // Use these hosts for accessing memcached program/include/rcmail.php
@@ -746,7 +746,7 @@ // before closing the database connection, write session data if ($_SERVER['REMOTE_ADDR'] && is_object($this->session)) { session_write_close(); $this->session->write_close(); } // write performance stats to logs/console program/lib/Roundcube/rcube.php
@@ -457,7 +457,6 @@ ini_set('session.name', $sess_name ? $sess_name : 'roundcube_sessid'); ini_set('session.use_cookies', 1); ini_set('session.use_only_cookies', 1); ini_set('session.serialize_handler', 'php'); ini_set('session.cookie_httponly', 1); // use database for storing session data @@ -471,7 +470,7 @@ // start PHP session (if not in CLI mode) if ($_SERVER['REMOTE_ADDR']) { session_start(); $this->session->start(); } } program/lib/Roundcube/rcube_session.php
@@ -42,6 +42,7 @@ private $secret = ''; private $ip_check = false; private $logging = false; private $storage; private $memcache; @@ -59,11 +60,14 @@ $this->set_lifetime($lifetime); // use memcache backend if ($config->get('session_storage', 'db') == 'memcache') { $this->storage = $config->get('session_storage', 'db'); if ($this->storage == 'memcache') { $this->memcache = rcube::get_instance()->get_memcache(); // set custom functions for PHP session management if memcache is available if ($this->memcache) { ini_set('session.serialize_handler', 'php'); session_set_save_handler( array($this, 'open'), array($this, 'close'), @@ -79,7 +83,9 @@ true, true); } } else { else if ($this->storage != 'php') { ini_set('session.serialize_handler', 'php'); // set custom functions for PHP session management session_set_save_handler( array($this, 'open'), @@ -88,6 +94,22 @@ array($this, 'db_write'), array($this, 'db_destroy'), array($this, 'db_gc')); } } /** * Wrapper for session_start() */ public function start() { session_start(); // copy some session properties to object vars if ($this->storage == 'php') { $this->key = session_id(); $this->ip = $_SESSION['__IP']; $this->changed = $_SESSION['__MTIME']; } } @@ -116,6 +138,20 @@ /** * Wrapper for session_write_close() */ public function write_close() { if ($this->storage == 'php') { $_SESSION['__IP'] = $this->ip; $_SESSION['__MTIME'] = time(); } session_write_close(); } /** * Read session data from database * * @param string Session ID