Fix Horde_Cache_Session creation.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:09:30 +0000 (13:09 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:28:03 +0000 (13:28 -0600)
Not sure how else to do this, but with the recent compress config option
added to horde/Cache, this is the only way to pickup this option. Also,
this was broken since theoretically use_memorycache could have been set
to true but creating Horde_Cache_Session this way would not have honored
that config setting.

framework/Core/lib/Horde/Core/Factory/Cache.php
framework/Core/lib/Horde/Registry.php

index d79822a..7539fc3 100644 (file)
@@ -42,6 +42,25 @@ class Horde_Core_Factory_Cache
             $driver = 'Null';
         }
 
+        return $this->_create($driver, $injector);
+    }
+
+    /**
+     * Return the Horde_Cache_Session:: instance.
+     *
+     * @return Horde_Cache_Session
+     * @throws Horde_Cache_Exception
+     */
+    public function createSession(Horde_Injector $injector)
+    {
+        return $this->_create('Session', $injector);
+    }
+
+    /**
+     * @see create()
+     */
+    private function _create($driver, $injector)
+    {
         $params = Horde::getDriverConfig('cache', $driver);
         if (isset($GLOBALS['conf']['cache']['default_lifetime'])) {
             $params['lifetime'] = $GLOBALS['conf']['cache']['default_lifetime'];
@@ -80,6 +99,8 @@ class Horde_Core_Factory_Cache
         return new $classname($params);
     }
 
+    /**
+     */
     protected function _driverToClassname($driver)
     {
         $driver = ucfirst(basename($driver));
index baa334f..0fcdb56 100644 (file)
@@ -296,6 +296,10 @@ class Horde_Registry
                 'Horde_Core_Factory_Cache',
                 'create',
             ),
+            'Horde_Cache_Session' => array(
+                'Horde_Core_Factory_Cache',
+                'createSession',
+            ),
             'Horde_Controller_Request' => array(
                 'Horde_Core_Factory_Request',
                 'create',