| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | ); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Object constructor. |
| | | * |
| | |
| | | $this->messages_table = $db->table_name('cache_messages', true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cleanup actions (on shutdown). |
| | | */ |
| | |
| | | $this->save_icache(); |
| | | $this->icache = null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set cache mode |
| | |
| | | { |
| | | $this->mode = $mode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return (sorted) messages index (UIDs). |
| | |
| | | return $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return messages thread. |
| | | * If threaded index doesn't exist or is invalid, will be updated. |
| | |
| | | |
| | | return $index['object']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns list of messages (headers). See rcube_imap::fetch_headers(). |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns message data. |
| | |
| | | return $message; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves the message in cache. |
| | | * |
| | |
| | | } |
| | | |
| | | $this->db->set_option('ignore_key_errors', true); |
| | | console($msg); |
| | | |
| | | // insert new record |
| | | $res = $this->db->query( |
| | | "INSERT INTO {$this->messages_table}" |
| | |
| | | |
| | | $this->db->set_option('ignore_key_errors', false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets the flag for specified message. |
| | |
| | | $this->userid, $mailbox); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Removes message(s) from cache. |
| | | * |
| | |
| | | $this->userid, $mailbox); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears index cache. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears thread cache. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears the cache. |
| | | * |
| | |
| | | $this->remove_thread($mailbox); |
| | | $this->remove_message($mailbox, $uids); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete expired cache entries |
| | |
| | | $db->query("DELETE FROM ".$db->table_name('cache_thread', true) |
| | | ." WHERE `expires` < $now"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches index data from database |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches thread data from database |
| | | */ |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves index data into database |
| | |
| | | $this->db->set_option('ignore_key_errors', false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves thread data into database |
| | | */ |
| | |
| | | |
| | | $this->db->set_option('ignore_key_errors', false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks index/thread validity |
| | |
| | | return false; |
| | | } |
| | | // ... and max UID |
| | | if ($object->max() != $this->imap->id2uid($mbox_data['EXISTS'], $mailbox, true)) { |
| | | if ($object->max() != $this->imap->id2uid($mbox_data['EXISTS'], $mailbox)) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Synchronizes the mailbox. |
| | |
| | | $this->icache[$mailbox]['index']['object'] = $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts cache row into message object. |
| | | * |
| | |
| | | return $message; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves message stored in internal cache |
| | | */ |
| | |
| | | $this->icache['__message']['md5sum'] = $md5sum; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Prepares message object to be stored in database. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches index data from IMAP server |
| | | */ |
| | |
| | | return $index; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches thread data from IMAP server |
| | | */ |
| | |
| | | |
| | | return new rcube_result_thread($mailbox, '* THREAD'); |
| | | } |
| | | |
| | | } |
| | | |
| | | // for backward compat. |