From 00cb22cf92d267fe602ad37336fba4454c6aa896 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 25 May 2013 09:46:20 -0400
Subject: [PATCH] Expunge all cache instances in shutdown
---
program/lib/Roundcube/rcube.php | 3 +++
program/lib/Roundcube/rcube_cache_shared.php | 2 +-
program/lib/Roundcube/rcube_imap.php | 3 +++
program/lib/Roundcube/rcube_cache.php | 2 +-
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index a57cad5..78d7959 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -897,6 +897,9 @@
foreach ($this->caches as $cache) {
if (is_object($cache)) {
+ if ($this->expunge_cache) {
+ $cache->expunge();
+ }
$cache->close();
}
}
diff --git a/program/lib/Roundcube/rcube_cache.php b/program/lib/Roundcube/rcube_cache.php
index 92f12a8..129f324 100644
--- a/program/lib/Roundcube/rcube_cache.php
+++ b/program/lib/Roundcube/rcube_cache.php
@@ -192,7 +192,7 @@
*/
function expunge()
{
- if ($this->type == 'db' && $this->db) {
+ if ($this->type == 'db' && $this->db && $this->ttl) {
$this->db->query(
"DELETE FROM ".$this->db->table_name('cache').
" WHERE user_id = ?".
diff --git a/program/lib/Roundcube/rcube_cache_shared.php b/program/lib/Roundcube/rcube_cache_shared.php
index bef9e85..c43d2ca 100644
--- a/program/lib/Roundcube/rcube_cache_shared.php
+++ b/program/lib/Roundcube/rcube_cache_shared.php
@@ -191,7 +191,7 @@
*/
function expunge()
{
- if ($this->type == 'db' && $this->db) {
+ if ($this->type == 'db' && $this->db && $this->ttl) {
$this->db->query(
"DELETE FROM " . $this->table
. " WHERE cache_key LIKE ?"
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 43c61fd..31e7079 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -3749,9 +3749,12 @@
$this->mcache->expunge($ttl);
}
+/*
+ // this cache is expunged by rcube class
if ($this->cache) {
$this->cache->expunge();
}
+*/
}
--
Gitblit v1.9.1