diff --git a/plugins/database_attachments/config.inc.php.dist b/plugins/database_attachments/config.inc.php.dist index b47615b79..b4464343c 100644 --- a/plugins/database_attachments/config.inc.php.dist +++ b/plugins/database_attachments/config.inc.php.dist @@ -2,7 +2,7 @@ // By default this plugin stores attachments in filesystem // and copies them into sql database. -// You can change it to use 'memcache' or 'apc'. +// You can change it to use 'memcache', 'redis' or 'apc'. // ----------------------------------------------------------- // WARNING: Remember to set max_allowed_packet in database or // config to match with expected max attachment size. diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php index 5e3268d80..b06717458 100644 --- a/plugins/database_attachments/database_attachments.php +++ b/plugins/database_attachments/database_attachments.php @@ -13,6 +13,8 @@ * @author Ziba Scott * @author Aleksander Machniak * + * Copyright (C) 2011-2018, The Roundcube Dev Team + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. diff --git a/plugins/redundant_attachments/composer.json b/plugins/redundant_attachments/composer.json index bdbd0ed34..78b9138f0 100644 --- a/plugins/redundant_attachments/composer.json +++ b/plugins/redundant_attachments/composer.json @@ -3,7 +3,7 @@ "type": "roundcube-plugin", "description": "This plugin provides a redundant storage for temporary uploaded attachment files. They are stored in both the database backend as well as on the local file system. It provides also memcache store as a fallback.", "license": "GPLv2", - "version": "1.1", + "version": "1.2", "authors": [ { "name": "Aleksander Machniak", diff --git a/plugins/redundant_attachments/config.inc.php.dist b/plugins/redundant_attachments/config.inc.php.dist index 9cc1b0034..b66d304c4 100644 --- a/plugins/redundant_attachments/config.inc.php.dist +++ b/plugins/redundant_attachments/config.inc.php.dist @@ -1,14 +1,15 @@ * @author Aleksander Machniak * - * Copyright (C) 2011, The Roundcube Dev Team - * Copyright (C) 2011, Kolab Systems AG + * Copyright (C) 2011-2018, The Roundcube Dev Team + * Copyright (C) 2011-2018, Kolab Systems AG * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -46,7 +46,7 @@ class redundant_attachments extends filesystem_attachments // rcube_cache instance for SQL DB private $cache; - // rcube_cache instance for memcache + // rcube_cache instance for memcache/redis private $mem_cache; private $loaded; @@ -66,20 +66,25 @@ 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); - $prefix = self::PREFIX; + $ttl = 12 * 60 * 60; // 12 hours + $ttl = $rcmail->config->get('redundant_attachments_cache_ttl', $ttl); + $fallback = $rcmail->config->get('redundant_attachments_fallback'); + $prefix = self::PREFIX; if ($id = session_id()) { $prefix .= $id; } + if ($fallback === null) { + $fallback = $rcmail->config->get('redundant_attachments_memcache') ? 'memcache' : null; // BC + } + // Init SQL cache (disable cache data serialization) $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($prefix, 'memcache', $ttl, false); + // Init memcache/redis (fallback) cache + if ($fallback) { + $this->mem_cache = $rcmail->get_cache($prefix, $fallback, $ttl, false); } $this->loaded = true;