From 613a5a327cc462583b251abf43a23e8c0fad39b5 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 29 Jan 2010 15:23:24 -0700 Subject: [PATCH] Add ability to get all cache information for a given UID --- framework/Imap_Client/lib/Horde/Imap/Client/Cache.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php b/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php index ee62a6e0e..39e45845b 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php @@ -221,7 +221,8 @@ class Horde_Imap_Client_Cache * @param array $uids The list of message UIDs to retrieve * information for. If empty, returns the list * of cached UIDs. - * @param array $fields An array of fields to retrieve. + * @param array $fields An array of fields to retrieve. If null, + * returns all cached fields. * @param integer $uidvalid The IMAP uidvalidity value of the mailbox. * * @return array An array of arrays with the UID of the message as the @@ -242,12 +243,16 @@ class Horde_Imap_Client_Cache $this->_loadUIDs($mailbox, $uids, $uidvalid); if (!empty($this->_data[$mailbox])) { - $fields = array_flip($fields); + if (!is_null($fields)) { + $fields = array_flip($fields); + } $ptr = &$this->_data[$mailbox]; foreach ($uids as $val) { if (isset($ptr[$val])) { - $ret_array[$val] = array_intersect_key($ptr[$val], $fields); + $ret_array[$val] = is_null($fields) + ? $ptr[$val] + : array_intersect_key($ptr[$val], $fields); } } -- 2.11.0