Make the cache object public accessible.
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 29 Jan 2010 08:00:12 +0000 (01:00 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 29 Jan 2010 18:21:20 +0000 (11:21 -0700)
framework/Imap_Client/lib/Horde/Imap/Client/Base.php
framework/Imap_Client/lib/Horde/Imap/Client/Cclient.php
framework/Imap_Client/lib/Horde/Imap/Client/Socket.php

index 220f3d9..e3fb759 100644 (file)
@@ -24,6 +24,13 @@ abstract class Horde_Imap_Client_Base
     public $utils;
 
     /**
+     * The Horde_Imap_Client_Cache object.
+     *
+     * @var Horde_Imap_Client_Cache
+     */
+    public $cache = null;
+
+    /**
      * Hash containing connection parameters.
      *
      * @var array
@@ -69,13 +76,6 @@ abstract class Horde_Imap_Client_Base
     );
 
     /**
-     * The Horde_Imap_Client_Cache object.
-     *
-     * @var Horde_Imap_Client_Cache
-     */
-    protected $_cache = null;
-
-    /**
      * The debug stream.
      *
      * @var resource
@@ -154,7 +154,7 @@ abstract class Horde_Imap_Client_Base
         $this->_closeDebug();
 
         // Don't store Horde_Imap_Client_Cache object or temp data.
-        $this->_cache = null;
+        $this->cache = null;
         $this->_temp = array();
 
         // Encrypt password in serialized object.
@@ -212,9 +212,9 @@ abstract class Horde_Imap_Client_Base
             return false;
         }
 
-        if (is_null($this->_cache)) {
+        if (is_null($this->cache)) {
             $p = $this->_params;
-            $this->_cache = Horde_Imap_Client_Cache::singleton(array_merge($p['cache'], array(
+            $this->cache = Horde_Imap_Client_Cache::singleton(array_merge($p['cache'], array(
                 'debug' => $this->_debug,
                 'hostspec' => $p['hostspec'],
                 'port' => $p['port'],
@@ -252,7 +252,7 @@ abstract class Horde_Imap_Client_Base
     public function getCache()
     {
         $this->_initCache();
-        return $this->_cache;
+        return $this->cache;
     }
 
     /**
@@ -720,7 +720,7 @@ abstract class Horde_Imap_Client_Base
 
         /* Delete mailbox caches. */
         if ($this->_initCache()) {
-            $this->_cache->deleteMailbox($mailbox);
+            $this->cache->deleteMailbox($mailbox);
         }
         unset($this->_temp['statuscache'][$mailbox]);
 
@@ -761,7 +761,7 @@ abstract class Horde_Imap_Client_Base
 
         /* Delete mailbox caches. */
         if ($this->_initCache()) {
-            $this->_cache->deleteMailbox($old);
+            $this->cache->deleteMailbox($old);
         }
         unset($this->_temp['statuscache'][$old]);
 
@@ -1274,7 +1274,7 @@ abstract class Horde_Imap_Client_Base
         $this->_mode = 0;
 
         if (!is_null($search_res)) {
-            $this->_cache->deleteMsgs($mbox, $search_res['match']);
+            $this->cache->deleteMsgs($mbox, $search_res['match']);
         }
     }
 
@@ -2073,10 +2073,10 @@ abstract class Horde_Imap_Client_Base
                     if (!$qresync) {
                         /* Grab all flags updated since the cached modseq
                          * val. */
-                        $metadata = $this->_cache->getMetaData($this->_selected, $status_res['uidvalidity'], array('HICmodseq'));
+                        $metadata = $this->cache->getMetaData($this->_selected, $status_res['uidvalidity'], array('HICmodseq'));
                         if (isset($metadata['HICmodseq']) &&
                             ($metadata['HICmodseq'] != $status_res['highestmodseq'])) {
-                            $uids = $this->_cache->get($this->_selected, array(), array(), $status_res['uidvalidity']);
+                            $uids = $this->cache->get($this->_selected, array(), array(), $status_res['uidvalidity']);
                             if (!empty($uids)) {
                                 $this->_fetch(array(Horde_Imap_Client::FETCH_FLAGS => true), array('changedsince' => $metadata['HICmodseq'], 'ids' => $uids));
                             }
@@ -2181,7 +2181,7 @@ abstract class Horde_Imap_Client_Base
 
         /* Get the cached values. */
         if (!empty($cache_array)) {
-            $data = $this->_cache->get($this->_selected, $uids, $get_fields, $status_res['uidvalidity']);
+            $data = $this->cache->get($this->_selected, $uids, $get_fields, $status_res['uidvalidity']);
         }
 
         // Build a list of what we still need.
@@ -2899,11 +2899,11 @@ abstract class Horde_Imap_Client_Base
             }
         }
 
-        $this->_cache->set($mailbox, $tocache, $uidvalid);
+        $this->cache->set($mailbox, $tocache, $uidvalid);
 
         if (!empty($highestmodseq)) {
             $modseq = max($highestmodseq);
-            $metadata = $this->_cache->getMetaData($mailbox, $uidvalid, array('HICmodseq'));
+            $metadata = $this->cache->getMetaData($mailbox, $uidvalid, array('HICmodseq'));
             if (!isset($metadata['HICmodseq']) ||
                 ($metadata['HICmodseq'] != $modseq)) {
                 $this->_temp['lastmodseq'][$mailbox] = $metadata['HICmodseq'];
@@ -2931,7 +2931,7 @@ abstract class Horde_Imap_Client_Base
         $cache = hash('md5', $type . serialize($options));
 
         $status = $this->status($mailbox, Horde_Imap_Client::STATUS_UIDVALIDITY);
-        $metadata = $this->_cache->getMetaData($mailbox, $status['uidvalidity'], array('HICsearch'));
+        $metadata = $this->cache->getMetaData($mailbox, $status['uidvalidity'], array('HICsearch'));
 
         $cacheid = $this->getCacheId($mailbox);
         if (isset($metadata['HICsearch']['cacheid']) &&
@@ -2991,7 +2991,7 @@ abstract class Horde_Imap_Client_Base
             $status = $this->status($mailbox, Horde_Imap_Client::STATUS_UIDVALIDITY);
             $uidvalid = $status['uidvalidity'];
         }
-        $this->_cache->setMetaData($mailbox, $uidvalid, $data);
+        $this->cache->setMetaData($mailbox, $uidvalid, $data);
     }
 
 }
index e02b3c7..4307cef 100644 (file)
@@ -761,7 +761,7 @@ class Horde_Imap_Client_Cclient extends Horde_Imap_Client_Base
                 }
 
                 if (!empty($expunged)) {
-                    $this->_cache->deleteMsgs($this->_selected, $expunged);
+                    $this->cache->deleteMsgs($this->_selected, $expunged);
                 }
             }
         }
index 1007a92..35afa55 100644 (file)
@@ -798,10 +798,10 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
         /* If QRESYNC is available, synchronize the mailbox. */
         if ($qresync) {
             $this->_initCache();
-            $metadata = $this->_cache->getMetaData($mailbox, null, array('HICmodseq', 'uidvalid'));
+            $metadata = $this->cache->getMetaData($mailbox, null, array('HICmodseq', 'uidvalid'));
 
             if (isset($metadata['HICmodseq'])) {
-                $uids = $this->_cache->get($mailbox);
+                $uids = $this->cache->get($mailbox);
                 if (!empty($uids)) {
                     /* This command may cause several things to happen.
                      * 1. UIDVALIDITY may have changed.  If so, we need
@@ -1528,7 +1528,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
 
             if (!empty($expunged)) {
                 if ($use_cache) {
-                    $this->_cache->deleteMsgs($mailbox, $expunged);
+                    $this->cache->deleteMsgs($mailbox, $expunged);
                 }
                 $tmp['mailbox']['messages'] -= $i;
 
@@ -1582,7 +1582,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
             if (strtoupper(reset($data[0])) == 'EARLIER') {
                 /* Caching is guaranteed to be active if we are using
                  * QRESYNC. */
-                $this->_cache->deleteMsgs($this->_temp['mailbox']['name'], $this->utils->fromSequenceString($data[1]));
+                $this->cache->deleteMsgs($this->_temp['mailbox']['name'], $this->utils->fromSequenceString($data[1]));
             }
         } else {
             /* The second form is just VANISHED. This is returned from an
@@ -2874,7 +2874,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
             if (empty($options['replace'])) {
                 /* Caching is guaranteed to be active if CONDSTORE is
                  * active. */
-                $data = $this->_cache->get($this->_selected, array_keys($uids), array('HICflags'), $this->_temp['mailbox']['uidvalidity']);
+                $data = $this->cache->get($this->_selected, array_keys($uids), array('HICflags'), $this->_temp['mailbox']['uidvalidity']);
 
                 foreach ($uids as $uid => $modseq) {
                     $flags = isset($data[$uid]['HICflags']) ? $data[$uid]['HICflags'] : array();
@@ -4024,7 +4024,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
 
             // Delete cache for mailbox, if it exists.
             if ($this->_initCache()) {
-                $this->_cache->deleteMailbox($this->_selected);
+                $this->cache->deleteMailbox($this->_selected);
             }
             break;