diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-04-10 10:49:10 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-04-10 10:49:10 +0200 |
commit | 8d34b9dce335883c0190e9e98232ce7b48a7b9c5 (patch) | |
tree | a60d851737bfd4c4fd0f73d0146c6bcd87518372 /program/lib/Roundcube/rcube.php | |
parent | eddaf0b5f68c9863181b62db33bc468d38071e8a (diff) |
Refactored storage properties setting
Diffstat (limited to 'program/lib/Roundcube/rcube.php')
-rw-r--r-- | program/lib/Roundcube/rcube.php | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 4ff0a00d7..7d28dce13 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -355,29 +355,6 @@ class rcube // for backward compat. (deprecated, will be removed) $this->imap = $this->storage; - // enable caching of mail data - $storage_cache = $this->config->get("{$driver}_cache"); - $messages_cache = $this->config->get('messages_cache'); - // for backward compatybility - if ($storage_cache === null && $messages_cache === null && $this->config->get('enable_caching')) { - $storage_cache = 'db'; - $messages_cache = true; - } - - if ($storage_cache) { - $this->storage->set_caching($storage_cache); - } - if ($messages_cache) { - $this->storage->set_messages_caching(true); - } - - // set pagesize from config - $pagesize = $this->config->get('mail_pagesize'); - if (!$pagesize) { - $pagesize = $this->config->get('pagesize', 50); - } - $this->storage->set_pagesize($pagesize); - // set class options $options = array( 'auth_type' => $this->config->get("{$driver}_auth_type", 'check'), @@ -412,19 +389,35 @@ class rcube /** * Set storage parameters. - * This must be done AFTER connecting to the server! */ protected function set_storage_prop() { $storage = $this->get_storage(); + // set pagesize from config + $pagesize = $this->config->get('mail_pagesize'); + if (!$pagesize) { + $pagesize = $this->config->get('pagesize', 50); + } + + $storage->set_pagesize($pagesize); $storage->set_charset($this->config->get('default_charset', RCUBE_CHARSET)); - if (isset($_SESSION['mbox'])) { - $storage->set_folder($_SESSION['mbox']); + // enable caching of mail data + $driver = $this->config->get('storage_driver', 'imap'); + $storage_cache = $this->config->get("{$driver}_cache"); + $messages_cache = $this->config->get('messages_cache'); + // for backward compatybility + if ($storage_cache === null && $messages_cache === null && $this->config->get('enable_caching')) { + $storage_cache = 'db'; + $messages_cache = true; } - if (isset($_SESSION['page'])) { - $storage->set_page($_SESSION['page']); + + if ($storage_cache) { + $storage->set_caching($storage_cache); + } + if ($messages_cache) { + $storage->set_messages_caching(true); } } |