From b0c83111deb571cf4a5d516bd613605a4d4d835e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 13 Dec 2018 16:23:28 +0000 Subject: [PATCH] Fix rcube_imap_cache in mode set to MESSAGE only --- program/lib/Roundcube/rcube_imap_cache.php | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php index 926203c3a..4cca3ac60 100644 --- a/program/lib/Roundcube/rcube_imap_cache.php +++ b/program/lib/Roundcube/rcube_imap_cache.php @@ -612,6 +612,10 @@ class rcube_imap_cache */ function remove_index($mailbox = null, $remove = false) { + if (!($this->mode & self::MODE_INDEX)) { + return; + } + // The index should be only removed from database when // UIDVALIDITY was detected or the mailbox is empty // otherwise use 'valid' flag to not loose HIGHESTMODSEQ value @@ -646,10 +650,14 @@ class rcube_imap_cache /** * Clears thread cache. * - * @param string $mailbox Folder name + * @param string $mailbox Folder name */ function remove_thread($mailbox = null) { + if (!($this->mode & self::MODE_INDEX)) { + return; + } + $this->db->query( "DELETE FROM {$this->thread_table}" ." WHERE `user_id` = ?" @@ -704,6 +712,10 @@ class rcube_imap_cache */ private function get_index_row($mailbox) { + if (!($this->mode & self::MODE_INDEX)) { + return; + } + // Get index from DB $sql_result = $this->db->query( "SELECT `data`, `valid`" @@ -731,8 +743,6 @@ class rcube_imap_cache 'modseq' => $data[5], ); } - - return null; } /** @@ -740,6 +750,10 @@ class rcube_imap_cache */ private function get_thread_row($mailbox) { + if (!($this->mode & self::MODE_INDEX)) { + return; + } + // Get thread from DB $sql_result = $this->db->query( "SELECT `data`" @@ -764,8 +778,6 @@ class rcube_imap_cache 'uidnext' => $data[3], ); } - - return null; } /** @@ -774,6 +786,10 @@ class rcube_imap_cache private function add_index_row($mailbox, $sort_field, $data, $mbox_data = array(), $exists = false, $modseq = null) { + if (!($this->mode & self::MODE_INDEX)) { + return; + } + $data = array( $this->db->encode($data, true), $sort_field, @@ -826,6 +842,10 @@ class rcube_imap_cache */ private function add_thread_row($mailbox, $data, $mbox_data = array(), $exists = false) { + if (!($this->mode & self::MODE_INDEX)) { + return; + } + $data = array( $this->db->encode($data, true), (int) $this->skip_deleted,