Need IMAP port to produce truly unique cache ID
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 27 Mar 2009 04:38:13 +0000 (22:38 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 27 Mar 2009 04:40:54 +0000 (22:40 -0600)
framework/Imap_Client/lib/Horde/Imap/Client/Base.php
framework/Imap_Client/lib/Horde/Imap/Client/Cache.php

index 9a6028b..0ffb03f 100644 (file)
@@ -215,6 +215,7 @@ abstract class Horde_Imap_Client_Base
             $this->_cache = Horde_Imap_Client_Cache::singleton(array_merge($p['cache'], array(
                 'debug' => $this->_debug,
                 'hostspec' => $p['hostspec'],
+                'port' => $p['port'],
                 'username' => $p['username']
             )));
         }
index e527418..9343c56 100644 (file)
@@ -10,6 +10,7 @@
  * 'driver' - (string) The Horde_Cache driver to use.
  * 'driver_params' - (string) The params to pass to the Horde_Cache driver.
  * 'hostspec' - (string) The IMAP hostspec.
+ * 'port' - (string) The IMAP port.
  * 'username' - (string) The IMAP username.
  *
  * Optional Parameters:
@@ -115,8 +116,9 @@ class Horde_Imap_Client_Cache
     {
         if (empty($params['driver']) ||
             empty($params['driver_params']) ||
-            empty($params['username']) ||
-            empty($params['hostspec'])) {
+            empty($params['hostspec']) ||
+            empty($params['port']) ||
+            empty($params['username'])) {
             throw new Horde_Imap_Client_Exception('Missing required parameters to Horde_Imap_Client_Cache.');
         }
 
@@ -152,6 +154,7 @@ class Horde_Imap_Client_Cache
             'debug' => empty($params['debug']) ? false : $params['debug'],
             'hostspec' => $params['hostspec'],
             'lifetime' => empty($params['lifetime']) ? 604800 : intval($params['lifetime']),
+            'port' => $params['port'],
             'slicesize' => empty($params['slicesize']) ? 50 : intval($params['slicesize']),
             'username' => $params['username']
         );
@@ -207,8 +210,8 @@ class Horde_Imap_Client_Cache
      */
     protected function _getCID($mailbox, $slice)
     {
-        /* Cache ID = "prefix | username | mailbox | hostspec | slice" */
-        return 'horde_imap_client|' . $this->_params['username'] . '|' . $mailbox . '|' . $this->_params['hostspec'] . '|' . $slice;
+        /* Cache ID = prefix | username | mailbox | hostspec | port | slice */
+        return implode('|', array('horde_imap_client', $this->_params['username'], $mailbox, $this->_params['hostspec'], $this->_params['port'], $slice));
     }
 
     /**