diff options
author | Aleksander Machniak <alec@alec.pl> | 2015-09-28 20:20:24 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2015-09-28 20:20:24 +0300 |
commit | e9ca5e0655164d8d279df824ff2f4cb40ad9dada (patch) | |
tree | 6ed9aa49d81cce5daf4914f352196e84bac00fc9 /plugins/redundant_attachments | |
parent | 72b281ed8441edbb525b84bb87b528514365b12d (diff) |
Fix so database_attachments::cleanup() does not remove attachments from other sessions (#1490542)
Diffstat (limited to 'plugins/redundant_attachments')
-rw-r--r-- | plugins/redundant_attachments/redundant_attachments.php | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/plugins/redundant_attachments/redundant_attachments.php b/plugins/redundant_attachments/redundant_attachments.php index 17427f0d8..fc7e06e6d 100644 --- a/plugins/redundant_attachments/redundant_attachments.php +++ b/plugins/redundant_attachments/redundant_attachments.php @@ -36,7 +36,7 @@ require_once(RCUBE_PLUGINS_DIR . 'filesystem_attachments/filesystem_attachments. class redundant_attachments extends filesystem_attachments { // A prefix for the cache key used in the session and in the key field of the cache table - private $prefix = "ATTACH"; + const PREFIX = "ATTACH"; // rcube_cache instance for SQL DB private $cache; @@ -46,13 +46,6 @@ class redundant_attachments extends filesystem_attachments private $loaded; - /** - * Default constructor - */ - function init() - { - parent::init(); - } /** * Loads plugin configuration and initializes cache object(s) @@ -68,15 +61,20 @@ class redundant_attachments extends filesystem_attachments // load configuration $this->load_config(); - $ttl = 12 * 60 * 60; // 12 hours - $ttl = $rcmail->config->get('redundant_attachments_cache_ttl', $ttl); + $ttl = 12 * 60 * 60; // 12 hours + $ttl = $rcmail->config->get('redundant_attachments_cache_ttl', $ttl); + $prefix = self::PREFIX; + + if ($id = session_id()) { + $prefix .= $id; + } // Init SQL cache (disable cache data serialization) - $this->cache = $rcmail->get_cache($this->prefix, 'db', $ttl, false); + $this->cache = $rcmail->get_cache($prefix, 'db', $ttl, false); // Init memcache (fallback) cache if ($rcmail->config->get('redundant_attachments_memcache')) { - $this->mem_cache = $rcmail->get_cache($this->prefix, 'memcache', $ttl, false); + $this->mem_cache = $rcmail->get_cache($prefix, 'memcache', $ttl, false); } $this->loaded = true; |