*/
protected function _init()
{
+ $GLOBALS['injector']->addBinder('IMP_Folder', new IMP_Injector_Binder_Folder());
$GLOBALS['injector']->addBinder('IMP_Imap_Tree', new IMP_Injector_Binder_Imaptree());
// Initialize global $imp_imap object.
/**
* Constructor.
+ *
+ * @param string $cacheid The cache ID to use, if folder list caching is
+ * enabled.
*/
- public function __construct()
+ public function __construct($cacheid = null)
{
- if (!empty($GLOBALS['conf']['server']['cache_folders'])) {
- $this->_cacheid = 'imp_folder_cache|' . Horde_Auth::getAuth();
- }
+ $this->_cacheid = $cacheid;
}
/**
*/
public function clearFlistCache()
{
- if (!is_null($this->_cacheid) && ($cache = $GLOBALS['injector']->getInstance('Horde_Cache'))) {
+ if (!is_null($this->_cacheid) &&
+ ($cache = $GLOBALS['injector']->getInstance('Horde_Cache'))) {
$cache->expire($this->_cacheid);
}
$this->_listCache = array();
--- /dev/null
+<?php
+/**
+ * Binder for IMP_Folder::.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package IMP
+ */
+class IMP_Injector_Binder_Folder implements Horde_Injector_Binder
+{
+ /**
+ */
+ public function create(Horde_Injector $injector)
+ {
+ $cacheid = empty($GLOBALS['conf']['server']['cache_folders'])
+ ? null
+ : 'imp_folder_cache|' . Horde_Auth::getAuth() . '|' . $_SESSION['imp']['server_key'];
+
+ return new IMP_Folder($cacheid);
+ }
+
+ /**
+ */
+ public function equals(Horde_Injector_Binder $binder)
+ {
+ return false;
+ }
+
+}