roundcubemail/program/lib/Roundcube/rcube_imap.php
public function expunge_message($uids, $folder = null, $clear_cache = true)
    {
        if ($uids && $this->get_capability('UIDPLUS')) {
            list($uids, $all_mode) = $this->parse_uids($uids);
        }
        else {
            $uids = null;
        }

        if (!strlen($folder)) {
            $folder = $this->folder;
        }

        if (!$this->check_connection()) {
            return false;
        }

        // force folder selection and check if folder is writeable
        // to prevent a situation when CLOSE is executed on closed
        // or EXPUNGE on read-only folder
        $result = $this->conn->select($folder);
        if (!$result) {
            return false;
        }

        if (!$this->conn->data['READ-WRITE']) {
            $this->conn->setError(rcube_imap_generic::ERROR_READONLY, "Folder is read-only");
            return false;
        }

        // CLOSE(+SELECT) should be faster than EXPUNGE
        if (empty($uids) || $all_mode) {
            $result = $this->conn->close();
        }
        else {
            $result = $this->conn->expunge($folder, $uids);
        }

        if ($result && $clear_cache) {
            $this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids));
            $this->clear_messagecount($folder);
        }

        return $result;
    }
public function expunge_message($uids, $folder = null, $clear_cache = true)
    {
        if ($uids && $this->get_capability('UIDPLUS')) {
            list($uids, $all_mode) = $this->parse_uids($uids);
        }
        else {
            $uids = null;
        }

        if (!strlen($folder)) {
            $folder = $this->folder;
        }

        if (!$this->check_connection()) {
            return false;
        }

        // force folder selection and check if folder is writeable
        // to prevent a situation when CLOSE is executed on closed
        // or EXPUNGE on read-only folder
        $result = $this->conn->select($folder);
        if (!$result) {
            return false;
        }

        if (!$this->conn->data['READ-WRITE']) {
            $this->conn->setError(rcube_imap_generic::ERROR_READONLY, "Folder is read-only");
            return false;
        }

        // CLOSE(+SELECT) should be faster than EXPUNGE
        if (empty($uids) || $all_mode) {
            $result = $this->conn->close();
        }
        else {
            $result = $this->conn->expunge($folder, $uids);
        }

        if ($result && $clear_cache) {
            $this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids));
            $this->clear_messagecount($folder);
        }

        return $result;
    }
public function expunge_message ( $ uids , $ folder = null , $ clear_cache = true ) { if ( $ uids && $ this -> get_capability ( 'UIDPLUS' ) ) { list ( $ uids , $ all_mode ) = $ this -> parse_uids ( $ uids ) ; } else { $ uids = null ; } if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( ! $ this -> check_connection ( ) ) { return false ; } // force folder selection and check if folder is writeable // to prevent a situation when CLOSE is executed on closed // or EXPUNGE on read-only folder $ result = $ this -> conn -> select ( $ folder ) ; if ( ! $ result ) { return false ; } if ( ! $ this -> conn -> data [ 'READ-WRITE' ] ) { $ this -> conn -> setError ( rcube_imap_generic :: ERROR_READONLY , "Folder is read-only" ) ; return false ; } // CLOSE(+SELECT) should be faster than EXPUNGE if ( empty ( $ uids ) || $ all_mode ) { $ result = $ this -> conn -> close ( ) ; } else { $ result = $ this -> conn -> expunge ( $ folder , $ uids ) ; } if ( $ result && $ clear_cache ) { $ this -> clear_message_cache ( $ folder , $ all_mode ? null : explode ( ',' , $ uids ) ) ; $ this -> clear_messagecount ( $ folder ) ; } return $ result ; }
Send IMAP expunge command and clear cache

@param mixed   $uids        Message UIDs as array or comma-separated string, or '*'
@param string  $folder      Folder name
@param boolean $clear_cache False if cache should not be cleared

@return boolean True on success, False on failure
Send IMAP expunge command and clear cache