From 1977fa14a9bc292de6d46139bbb42fc629d76b5a Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 14 Oct 2014 08:12:32 -0400
Subject: [PATCH] More config cache tweaking.

---
 config/application.config.php | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/config/application.config.php b/config/application.config.php
index 10383a89dff..357a2e6f653 100644
--- a/config/application.config.php
+++ b/config/application.config.php
@@ -19,7 +19,8 @@ if ($localModules = getenv('VUFIND_LOCAL_MODULES')) {
     }
 }
 
-// Set up cache directory (be sure to keep separate cache for CLI vs. web):
+// Set up cache directory (be sure to keep separate cache for CLI vs. web and
+// to account for potentially variant environment settings):
 $baseDir = ($local = getenv('VUFIND_LOCAL_DIR')) ? $local : 'data';
 if (PHP_SAPI == 'cli') {
     $cacheDir = $baseDir . '/cache/cli';
@@ -33,6 +34,15 @@ if (PHP_SAPI == 'cli') {
 if (!is_dir($cacheDir)) {
     mkdir($cacheDir);
 }
+$cacheHash = md5(
+    APPLICATION_ENV
+    . (defined('VUFIND_LOCAL_DIR') ? VUFIND_LOCAL_DIR : '')
+    . implode(',', $modules)
+);
+$cacheDir .= '/' . $cacheHash;
+if (!is_dir($cacheDir)) {
+    mkdir($cacheDir);
+}
 
 // Enable caching unless in dev mode or running tests:
 $useCache = APPLICATION_ENV != 'development' && !defined('VUFIND_PHPUNIT_RUNNING');
-- 
GitLab