diff options
author | thomascube <thomas@roundcube.net> | 2012-02-21 20:46:15 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2012-02-21 20:46:15 +0000 |
commit | 249303d4415bc77b5f57abe1780322b45a1a9578 (patch) | |
tree | a479eaa926766a66cb4b60e31701319833192ffa | |
parent | b8e6ba1908a9d2e9c5f22f8c4cc532d06e685ed0 (diff) |
Fix message cache expunge after config options changed
-rw-r--r-- | program/include/main.inc | 8 | ||||
-rw-r--r-- | program/include/rcmail.php | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index fae289ba8..33a7c5cbc 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -169,14 +169,16 @@ function rcmail_cache_gc() // get target timestamp $ts = get_offset_time($rcmail->config->get('message_cache_lifetime', '30d'), -1); - $db->query("DELETE FROM ".get_table_name('cache_messages') + if ($rcmail->config->get('messages_cache') || $this->config->get('enable_caching')) { + $db->query("DELETE FROM ".get_table_name('cache_messages') ." WHERE changed < " . $db->fromunixtime($ts)); - $db->query("DELETE FROM ".get_table_name('cache_index') + $db->query("DELETE FROM ".get_table_name('cache_index') ." WHERE changed < " . $db->fromunixtime($ts)); - $db->query("DELETE FROM ".get_table_name('cache_thread') + $db->query("DELETE FROM ".get_table_name('cache_thread') ." WHERE changed < " . $db->fromunixtime($ts)); + } $db->query("DELETE FROM ".get_table_name('cache') ." WHERE created < " . $db->fromunixtime($ts)); diff --git a/program/include/rcmail.php b/program/include/rcmail.php index f6e2b4b59..a3c04ef95 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -704,8 +704,7 @@ class rcmail $this->session = new rcube_session($this->get_dbh(), $this->config); $this->session->register_gc_handler('rcmail_temp_gc'); - if ($this->config->get('enable_caching')) - $this->session->register_gc_handler('rcmail_cache_gc'); + $this->session->register_gc_handler('rcmail_cache_gc'); // start PHP session (if not in CLI mode) if ($_SERVER['REMOTE_ADDR']) |