Skip to content
Snippets Groups Projects
Commit b16fb7bb authored by Demian Katz's avatar Demian Katz
Browse files

Fixed bug: caching broke CLI tools.

parent 25722218
No related merge requests found
...@@ -19,13 +19,24 @@ if ($localModules = getenv('VUFIND_LOCAL_MODULES')) { ...@@ -19,13 +19,24 @@ if ($localModules = getenv('VUFIND_LOCAL_MODULES')) {
} }
} }
// Set up cache directory: // Set up cache directory (be sure to keep separate cache for CLI vs. web):
$baseDir = ($local = getenv('VUFIND_LOCAL_DIR')) ? $local : 'data'; $baseDir = ($local = getenv('VUFIND_LOCAL_DIR')) ? $local : 'data';
$cacheDir = $baseDir . '/cache/configs'; if (PHP_SAPI == 'cli') {
$cacheDir = $baseDir . '/cache/cli';
if (!is_dir($cacheDir)) {
mkdir($cacheDir);
}
$cacheDir .= '/configs';
} else {
$cacheDir = $baseDir . '/cache/configs';
}
if (!is_dir($cacheDir)) { if (!is_dir($cacheDir)) {
mkdir($cacheDir); mkdir($cacheDir);
} }
// Enable caching unless in dev mode or running tests:
$useCache = APPLICATION_ENV != 'development' && !defined('VUFIND_PHPUNIT_RUNNING');
// Build configuration: // Build configuration:
return array( return array(
'modules' => array_unique($modules), 'modules' => array_unique($modules),
...@@ -33,8 +44,8 @@ return array( ...@@ -33,8 +44,8 @@ return array(
'config_glob_paths' => array( 'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php', 'config/autoload/{,*.}{global,local}.php',
), ),
'config_cache_enabled' => (APPLICATION_ENV != 'development'), 'config_cache_enabled' => $useCache,
'module_map_cache_enabled' => (APPLICATION_ENV != 'development'), 'module_map_cache_enabled' => $useCache,
'check_dependencies' => (APPLICATION_ENV == 'development'), 'check_dependencies' => (APPLICATION_ENV == 'development'),
'cache_dir' => $cacheDir, 'cache_dir' => $cacheDir,
'module_paths' => array( 'module_paths' => array(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment