phpdoc, make header caching configurable
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 4 Dec 2009 08:56:41 +0000 (01:56 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 4 Dec 2009 18:49:17 +0000 (11:49 -0700)
framework/Imap_Client/lib/Horde/Imap/Client.php
framework/Imap_Client/lib/Horde/Imap/Client/Base.php

index 4bbbf14..856b869 100644 (file)
  * 'fields' - [OPTIONAL] (array) The fetch criteria to cache. If not defined,
  *            all cacheable data is cached. The following is a list of
  *            criteria that can be cached:
- * <pre>
- * Horde_Imap_Client::FETCH_STRUCTURE
- * Horde_Imap_Client::FETCH_ENVELOPE
- * Horde_Imap_Client::FETCH_FLAGS (only if server supports CONDSTORE IMAP
- *                                 extension)
- * Horde_Imap_Client::FETCH_DATE
- * Horde_Imap_Client::FETCH_SIZE
- * </pre>
+ *            + Horde_Imap_Client::FETCH_DATE
+ *            + Horde_Imap_Client::FETCH_ENVELOPE
+ *            + Horde_Imap_Client::FETCH_FLAGS
+ *              Only if server supports CONDSTORE extension
+ *            + Horde_Imap_Client::FETCH_HEADERS
+ *              Only for queries that specifically request caching
+ *            + Horde_Imap_Client::FETCH_SIZE
+ *            + Horde_Imap_Client::FETCH_STRUCTURE
  * 'lifetime' - [OPTIONAL] (integer) The lifetime of the cache data (in secs).
  * 'slicesize' - [OPTIONAL] (integer) The slicesize to use.
  * </pre>
index 850987c..ff9d41a 100644 (file)
@@ -123,7 +123,8 @@ abstract class Horde_Imap_Client_Base
                 Horde_Imap_Client::FETCH_ENVELOPE => 1,
                 Horde_Imap_Client::FETCH_FLAGS => 1,
                 Horde_Imap_Client::FETCH_DATE => 1,
-                Horde_Imap_Client::FETCH_SIZE => 1
+                Horde_Imap_Client::FETCH_SIZE => 1,
+                Horde_Imap_Client::FETCH_HEADERS => 1
             );
         } else {
             $params['cache']['fields'] = array_flip($params['cache']['fields']);
@@ -2034,7 +2035,7 @@ abstract class Horde_Imap_Client_Base
                 $this->_temp['headers_caching'] = array();
 
                 /* Only cache if directly requested. */
-                if ($cache_avail) {
+                if (isset($cf[$k]) && $cache_avail) {
                     $fetch_field = 'headers';
 
                     foreach ($v as $key => $val) {