From 60be1baf82f860ef5e94218d676e1a2721dbf260 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 29 Aug 2012 14:17:51 -0400
Subject: [PATCH] Moved session handler manager configuration into config file.

---
 module/VuFind/config/module.config.php | 14 ++++++++++++++
 module/VuFind/src/VuFind/Bootstrap.php | 25 +++++++------------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php
index a0697ab75be..c9503d8d92d 100644
--- a/module/VuFind/config/module.config.php
+++ b/module/VuFind/config/module.config.php
@@ -107,6 +107,20 @@ $config = array(
             'sessionmanager' => 'Zend\Session\SessionManager',
         )
     ),
+    'session_handler_manager' => array(
+        'abstract_factories' => array('VuFind\Session\PluginFactory'),
+        'invokables' => array(
+            'database' => 'VuFind\Session\Database',
+            'file' => 'VuFind\Session\File',
+            'memcache' => 'VuFind\Session\Memcache',
+        ),
+        'aliases' => array(
+            // for legacy 1.x compatibility
+            'filesession' => 'File',
+            'memcachesession' => 'Memcache',
+            'mysqlsession' => 'Database',
+        ),
+    ),
     'translator' => array(),
     'view_manager' => array(
         'display_not_found_reason' => APPLICATION_ENV == 'development',
diff --git a/module/VuFind/src/VuFind/Bootstrap.php b/module/VuFind/src/VuFind/Bootstrap.php
index 361b4de6c42..73562479761 100644
--- a/module/VuFind/src/VuFind/Bootstrap.php
+++ b/module/VuFind/src/VuFind/Bootstrap.php
@@ -84,25 +84,14 @@ class Bootstrap
      */
     protected function initPluginManagers()
     {
-        $serviceManager = $this->event->getApplication()->getServiceManager();
-        $config = new ServiceManagerConfig(
-            array(
-                'abstract_factories' => array('VuFind\Session\PluginFactory'),
-                'invokables' => array(
-                    'database' => 'VuFind\Session\Database',
-                    'file' => 'VuFind\Session\File',
-                    'memcache' => 'VuFind\Session\Memcache',
-                ),
-                'aliases' => array(
-                    // for legacy 1.x compatibility
-                    'filesession' => 'File',
-                    'memcachesession' => 'Memcache',
-                    'mysqlsession' => 'Database',
-                ),
-            )
-        );
+        $app = $this->event->getApplication();
+        $serviceManager = $app->getServiceManager();
+        $config = $app->getConfig();
+
         $serviceManager->setService(
-            'SessionHandlerManager', new \VuFind\Session\PluginManager($config)
+            'SessionHandlerManager', new \VuFind\Session\PluginManager(
+                new ServiceManagerConfig($config['session_handler_manager'])
+            )
         );
     }
 
-- 
GitLab