From edae2652b3dcb6f372fe8da125f258f1afd7a9d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kozlovsk=C3=BD?=
 <jirislav@users.noreply.github.com>
Date: Thu, 31 Mar 2016 15:13:21 -0400
Subject: [PATCH] Added drivers_config_path to Multibackend.ini - It is
 optional configuration specifying the path to the drivers configurations
 relative to vufind config dir -- omit to locate those in vufind config dir --
 it also could be an absolute path

---
 config/vufind/MultiBackend.ini                  |  5 +++++
 .../src/VuFind/ILS/Driver/MultiBackend.php      | 17 ++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/config/vufind/MultiBackend.ini b/config/vufind/MultiBackend.ini
index cfea7a07cad..4ae37f3e014 100644
--- a/config/vufind/MultiBackend.ini
+++ b/config/vufind/MultiBackend.ini
@@ -4,6 +4,11 @@
 ; from the [Drivers] section below if set -- omit to have no default driver)
 ;default_driver = "instance1"
 
+; (Optional) the path to the driver configurations relative to VuFind config
+; dir -- omit to locate those in VuFind config dir -- it also could be an
+; absolute path
+;drivers_config_path = private
+
 ; This section is for declaring which driver to use for each institution.
 ; The key should be the Source ID of a specific institution, and the value
 ; should be the name of an ILS driver.
diff --git a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php
index bd13f223f5e..24678c7037d 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php
@@ -65,6 +65,13 @@ class MultiBackend extends AbstractBase
      * @var string
      */
     protected $defaultDriver;
+    
+    /**
+     * The path to the driver configurations relative to the config path
+     * 
+     * @var string
+     */
+    protected $driversConfigPath;
 
     /**
      * The array of cached drivers
@@ -137,6 +144,10 @@ class MultiBackend extends AbstractBase
         $this->defaultDriver = isset($this->config['General']['default_driver'])
             ? $this->config['General']['default_driver']
             : null;
+        $this->driversConfigPath
+            = isset($this->config['General']['drivers_config_path'])
+            ? $this->config['General']['drivers_config_path']
+            : null;
     }
 
     /**
@@ -1354,7 +1365,11 @@ class MultiBackend extends AbstractBase
     {
         // Determine config file name based on class name:
         try {
-            $config = $this->configLoader->get($source);
+            $path = empty($this->driversConfigPath)
+                ? $source
+                : $this->driversConfigPath . '/' . $source;
+
+            $config = $this->configLoader->get($path);
         } catch (\Zend\Config\Exception\RuntimeException $e) {
             // Configuration loading failed; probably means file does not
             // exist -- just return an empty array in that case:
-- 
GitLab