| | |
| | | protected $search_sort_field = ''; |
| | | protected $search_threads = false; |
| | | protected $search_sorted = false; |
| | | protected $options = array('auth_method' => 'check'); |
| | | protected $options = array('auth_type' => 'check'); |
| | | protected $caching = false; |
| | | protected $messages_caching = false; |
| | | protected $threading = false; |
| | |
| | | public function check_permflag($flag) |
| | | { |
| | | $flag = strtoupper($flag); |
| | | $imap_flag = $this->conn->flags[$flag]; |
| | | $perm_flags = $this->get_permflags($this->folder); |
| | | $imap_flag = $this->conn->flags[$flag]; |
| | | |
| | | return in_array_nocase($imap_flag, $perm_flags); |
| | | return $imap_flag && !empty($perm_flags) && in_array_nocase($imap_flag, $perm_flags); |
| | | } |
| | | |
| | | |
| | |
| | | if (!strlen($folder)) { |
| | | return array(); |
| | | } |
| | | /* |
| | | Checking PERMANENTFLAGS is rather rare, so we disable caching of it |
| | | Re-think when we'll use it for more than only MDNSENT flag |
| | | |
| | | $cache_key = 'mailboxes.permanentflags.' . $folder; |
| | | $permflags = $this->get_cache($cache_key); |
| | | |
| | | if ($permflags !== null) { |
| | | return explode(' ', $permflags); |
| | | } |
| | | */ |
| | | if (!$this->check_connection()) { |
| | | return array(); |
| | | } |
| | |
| | | if (!is_array($permflags)) { |
| | | $permflags = array(); |
| | | } |
| | | /* |
| | | // Store permflags as string to limit cached object size |
| | | $this->update_cache($cache_key, implode(' ', $permflags)); |
| | | */ |
| | | |
| | | return $permflags; |
| | | } |
| | | |
| | |
| | | /** |
| | | * Enable or disable messages caching |
| | | * |
| | | * @param boolean $set Flag |
| | | * @param boolean $set Flag |
| | | * @param int $mode Cache mode |
| | | */ |
| | | public function set_messages_caching($set) |
| | | public function set_messages_caching($set, $mode = null) |
| | | { |
| | | if ($set) { |
| | | $this->messages_caching = true; |
| | | |
| | | if ($mode && ($cache = $this->get_mcache_engine())) { |
| | | $cache->set_mode($mode); |
| | | } |
| | | } |
| | | else { |
| | | if ($this->mcache) { |
| | |
| | | if ($this->messages_caching && !$this->mcache) { |
| | | $rcube = rcube::get_instance(); |
| | | if (($dbh = $rcube->get_dbh()) && ($userid = $rcube->get_user_id())) { |
| | | $ttl = $rcube->config->get('messages_cache_ttl', '10d'); |
| | | $ttl = $rcube->config->get('messages_cache_ttl', '10d'); |
| | | $threshold = $rcube->config->get('messages_cache_threshold', 50); |
| | | $this->mcache = new rcube_imap_cache( |
| | | $dbh, $this, $userid, $this->options['skip_deleted'], $ttl); |
| | | $dbh, $this, $userid, $this->options['skip_deleted'], $ttl, $threshold); |
| | | } |
| | | } |
| | | |
| | |
| | | * Clears the messages cache. |
| | | * |
| | | * @param string $folder Folder name |
| | | * @param array $uids Optional message UIDs to remove from cache |
| | | * @param array $uids Optional message UIDs to remove from cache |
| | | */ |
| | | protected function clear_message_cache($folder = null, $uids = null) |
| | | { |