Example #1
0
 /**
  * Clear all messages in a specific mailbox
  *
  * @param string $mbox_name Mailbox name
  * @return int Above 0 on success
  */
 function clear_mailbox($mbox_name = NULL)
 {
     $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox;
     // SELECT will set messages count for clearFolder()
     if ($this->conn->select($mailbox)) {
         $cleared = $this->conn->clearFolder($mailbox);
     }
     // make sure the message count cache is cleared as well
     if ($cleared) {
         $this->clear_message_cache($mailbox . '.msg');
         $a_mailbox_cache = $this->get_cache('messagecount');
         unset($a_mailbox_cache[$mailbox]);
         $this->update_cache('messagecount', $a_mailbox_cache);
     }
     return $cleared;
 }
Example #2
0
 /**
  * Clear all messages in a specific mailbox
  *
  * @param string $mailbox Mailbox name
  *
  * @return int Above 0 on success
  */
 function clear_mailbox($mailbox = null)
 {
     if (!strlen($mailbox)) {
         $mailbox = $this->mailbox;
     }
     // SELECT will set messages count for clearFolder()
     if ($this->conn->select($mailbox)) {
         $cleared = $this->conn->clearFolder($mailbox);
     }
     // make sure the cache is cleared as well
     if ($cleared) {
         $this->clear_message_cache($mailbox);
         $a_mailbox_cache = $this->get_cache('messagecount');
         unset($a_mailbox_cache[$mailbox]);
         $this->update_cache('messagecount', $a_mailbox_cache);
     }
     return $cleared;
 }