| | |
| | | // try to subscribe it |
| | | if ($result) { |
| | | // clear cache |
| | | $this->clear_cache('/^mailboxes.*/', true); |
| | | $this->clear_cache('mailboxes', true); |
| | | |
| | | if ($subscribe) |
| | | $this->subscribe($mailbox); |
| | |
| | | |
| | | // clear cache |
| | | $this->clear_message_cache($mailbox.'.msg'); |
| | | $this->clear_cache('/^mailboxes.*/', true); |
| | | $this->clear_cache('mailboxes', true); |
| | | } |
| | | |
| | | return $result; |
| | |
| | | |
| | | // clear mailbox-related cache |
| | | $this->clear_message_cache($mailbox.'.msg'); |
| | | $this->clear_cache('/^mailboxes.*/', true); |
| | | $this->clear_cache('mailboxes', true); |
| | | } |
| | | |
| | | return $result; |
| | |
| | | /** |
| | | * Clears the cache. |
| | | * |
| | | * @param string $key Cache key name or pattern |
| | | * @param boolean $pattern_mode Enable it to clear all keys with name |
| | | * matching PREG pattern in $key |
| | | * @param string $key Cache key name or pattern |
| | | * @param boolean $prefix_mode Enable it to clear all keys starting |
| | | * with prefix specified in $key |
| | | * @access public |
| | | */ |
| | | function clear_cache($key=null, $pattern_mode=false) |
| | | function clear_cache($key=null, $prefix_mode=false) |
| | | { |
| | | if ($this->cache) { |
| | | $this->cache->remove($key, $pattern_mode); |
| | | $this->cache->remove($key, $prefix_mode); |
| | | } |
| | | } |
| | | |
| | |
| | | $updated = $this->conn->unsubscribe($mailbox); |
| | | } |
| | | |
| | | // get cached mailbox list |
| | | // clear cached mailbox list(s) |
| | | if ($updated) { |
| | | $a_mailbox_cache = $this->get_cache('mailboxes'); |
| | | if (!is_array($a_mailbox_cache)) |
| | | return $updated; |
| | | |
| | | // modify cached list |
| | | if ($mode == 'subscribe') |
| | | $a_mailbox_cache = array_merge($a_mailbox_cache, $a_mboxes); |
| | | else if ($mode == 'unsubscribe') |
| | | $a_mailbox_cache = array_diff($a_mailbox_cache, $a_mboxes); |
| | | |
| | | // write mailboxlist to cache |
| | | $this->update_cache('mailboxes', $this->_sort_mailbox_list($a_mailbox_cache)); |
| | | $this->clear_cache('mailboxes', true); |
| | | } |
| | | |
| | | return $updated; |