public setMetaData ( string $mailbox, integer $uidvalid, array $data = [] ) | ||
$mailbox | string | An IMAP mailbox string. |
$uidvalid | integer | The IMAP uidvalidity value of the mailbox. |
$data | array | The list of data to save. The keys are the metadata IDs, the values are the associated data. The following labels are reserved: 'uidvalid'. |
public function setMetaData($mailbox, $uidvalid, array $data = array())
{
unset($data['uidvalid']);
if (!empty($data)) {
if (!empty($uidvalid)) {
$data['uidvalid'] = $uidvalid;
}
$mailbox = strval($mailbox);
$this->_backend->setMetaData($mailbox, $data);
if ($this->_debug) {
$this->_debug->info(sprintf('CACHE: Stored metadata (%s [%s])', implode(',', array_keys($data)), $mailbox));
}
}
}
/** * Updates the cached MODSEQ value. * * @param integer $modseq MODSEQ value to store. * * @return mixed The MODSEQ of the old value if it was replaced (or false * if it didn't exist or is the same). */ protected function _updateModSeq($modseq) { if (!$this->_initCache(true)) { return false; } $mbox_ob = $this->_mailboxOb(); $uidvalid = $mbox_ob->getStatus(Horde_Imap_Client::STATUS_UIDVALIDITY); $md = $this->_cache->getMetaData($this->_selected, $uidvalid, array(self::CACHE_MODSEQ)); if (isset($md[self::CACHE_MODSEQ])) { if ($md[self::CACHE_MODSEQ] < $modseq) { $set = true; $sync = $md[self::CACHE_MODSEQ]; } else { $set = false; $sync = 0; } $mbox_ob->setStatus(Horde_Imap_Client::STATUS_SYNCMODSEQ, $md[self::CACHE_MODSEQ]); } else { $set = true; $sync = 0; } /* $modseq can be 0 - NOMODSEQ - so don't store in that case. */ if ($set && $modseq) { $this->_cache->setMetaData($this->_selected, $uidvalid, array(self::CACHE_MODSEQ => $modseq)); } return $sync; }