Fix bug where messages count was not updated after delete when imap_cache is set (#5872)

pull/5209/merge
Aleksander Machniak 7 years ago
parent 040a71e76c
commit fc1a0a1f65

@ -49,6 +49,7 @@ CHANGELOG Roundcube Webmail
- Fix PHP 7.2 warnings on count() use (#5845)
- Fix bug where Chrome could not upload the same file that was selected before (#5854)
- Fix duplicate messages on the list after deleting messages on the next to the last page (#5862)
- Fix bug where messages count was not updated after delete when imap_cache is set (#5872)
RELEASE 1.3.0
-------------

@ -2495,13 +2495,12 @@ class rcube_imap extends rcube_storage
// clear cached counters
if ($flag == 'SEEN' || $flag == 'UNSEEN') {
$this->clear_messagecount($folder, 'SEEN');
$this->clear_messagecount($folder, 'UNSEEN');
$this->clear_messagecount($folder, array('SEEN', 'UNSEEN'));
}
else if ($flag == 'DELETED' || $flag == 'UNDELETED') {
$this->clear_messagecount($folder, 'DELETED');
// remove cached messages
$this->clear_messagecount($folder, array('ALL', 'THREADS'));
if ($this->options['skip_deleted']) {
// remove cached messages
$this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids));
}
}
@ -4415,13 +4414,15 @@ class rcube_imap extends rcube_storage
/**
* Remove messagecount of a specific folder from cache
*/
protected function clear_messagecount($folder, $mode=null)
protected function clear_messagecount($folder, $mode = array())
{
$a_folder_cache = $this->get_cache('messagecount');
if (is_array($a_folder_cache[$folder])) {
if ($mode) {
unset($a_folder_cache[$folder][$mode]);
if (!empty($mode)) {
foreach ((array) $mode as $key) {
unset($a_folder_cache[$folder][$key]);
}
}
else {
unset($a_folder_cache[$folder]);

Loading…
Cancel
Save