Skip to content
Snippets Groups Projects
Commit f4d04e09 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Merge branch 'master' of https://github.com/vufind-org/vufind

parents 0d94f59f c7e23480
No related merge requests found
......@@ -22,7 +22,7 @@ if ($localModules = getenv('VUFIND_LOCAL_MODULES')) {
// 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';
$cacheDir = $baseDir . '/cache';
$cacheDir = ($cache = getenv('VUFIND_CACHE_DIR')) ? $cache : $baseDir . '/cache';
if (!is_dir($cacheDir)) {
mkdir($cacheDir);
}
......
......@@ -1139,16 +1139,12 @@ dewey = title
HMACkey = mySuperSecretValue
; This section sets global defaults for caches; file caching is used by default.
; A custom directory for caching can be defined by the environment variable
; VUFIND_CACHE_DIR (see httpd-vufind.conf). The default location is inside the
; local settings directory.
;[Cache]
; Set time to live value for Zend caches (in seconds), 0 means maximum possible.
;ttl = 0
; This setting can be used to force caching in a specific location other than the
; default location inside the local settings directory. This directory must exist
; and be writable by the web server. Do not share this directory between multiple
; instances of VuFind or you may encounter unexpected side effects -- while this
; directory may be outside of the local settings directory, there should be exactly
; one separate cache location per local settings directory.
;cache_dir = "local/cache/"
; Override umask for cache directories and files.
;umask = 022
; Permissions for Zend-created cache directories and files, subject to umask
......
......@@ -57,6 +57,14 @@ Alias /vufind /usr/local/vufind/public
# to override VuFind core features/settings. Set to blank string ("") to disable.
SetEnv VUFIND_LOCAL_DIR /usr/local/vufind/local
# This line can be used to force caching in a specific location other than the
# default location inside the local settings directory.
# Do not share this directory between multiple instances of VuFind or you may
# encounter unexpected side effects -- while this directory may be outside of the
# local settings directory, there should be exactly one separate cache location per
# local settings directory.
#SetEnv VUFIND_CACHE_DIR /usr/local/vufind/cache
# This line specifies additional Zend Framework 2 modules to load after the standard VuFind module.
# Multiple modules may be specified separated by commas. This mechanism can be used to override
# core VuFind functionality without modifying core code.
......
......@@ -148,11 +148,16 @@ class Manager
public function getCacheDir($allowCliOverride = true)
{
if ($this->defaults && isset($this->defaults['cache_dir'])) {
$dir = $this->defaults['cache_dir'];
// ensure trailing slash:
if (substr($dir, -1) != '/') {
$dir .= '/';
}
// cache_dir setting in config.ini is deprecated
throw new \Exception(
'Deprecated cache_dir setting found in config.ini - please use '
. 'Apache environment variable VUFIND_CACHE_DIR in '
. 'httpd-vufind.conf instead.'
);
}
if (strlen(LOCAL_CACHE_DIR) > 0) {
$dir = LOCAL_CACHE_DIR . '/';
} else if (strlen(LOCAL_OVERRIDE_DIR) > 0) {
$dir = LOCAL_OVERRIDE_DIR . '/cache/';
} else {
......
......@@ -73,7 +73,8 @@ class CombinedController extends AbstractSearch
$searchClassId = $this->params()->fromQuery('id');
$config = $this->getServiceLocator()->get('VuFind\Config')->get('combined')
->toArray();
if (!isset($config[$searchClassId])) {
$tabConfig = $this->getTabConfig($config);
if (!isset($tabConfig[$searchClassId])) {
throw new \Exception('Illegal ID');
}
......@@ -83,7 +84,7 @@ class CombinedController extends AbstractSearch
$currentOptions = $options->get($searchClassId);
list($controller, $action)
= explode('-', $currentOptions->getSearchAction());
$settings = $config[$searchClassId];
$settings = $tabConfig[$searchClassId];
$this->adjustQueryForSettings($settings);
$settings['view'] = $this->forwardTo($controller, $action);
......@@ -149,11 +150,7 @@ class CombinedController extends AbstractSearch
->toArray();
$supportsCart = false;
$supportsCartOptions = [];
foreach ($config as $current => $settings) {
// Special case -- ignore recommendation config:
if ($current == 'Layout' || $current == 'RecommendationModules') {
continue;
}
foreach ($this->getTabConfig($config) as $current => $settings) {
$this->adjustQueryForSettings($settings);
$currentOptions = $options->get($current);
$supportsCartOptions[] = $currentOptions->supportsCart();
......@@ -274,4 +271,20 @@ class CombinedController extends AbstractSearch
$query->noRecommend = 'top,side';
}
}
/**
* Get tab configuration based on the full combined results configuration.
*
* @param array $config Combined results configuration
*
* @return array
*/
protected function getTabConfig($config)
{
// Strip out non-tab sections of the configuration:
unset($config['Layout']);
unset($config['RecommendationModules']);
return $config;
}
}
......@@ -33,6 +33,14 @@ defined('LOCAL_OVERRIDE_DIR')
(getenv('VUFIND_LOCAL_DIR') ? getenv('VUFIND_LOCAL_DIR') : '')
);
// Define path to cache directory
defined('LOCAL_CACHE_DIR')
|| define(
'LOCAL_CACHE_DIR',
(getenv('VUFIND_CACHE_DIR')
? getenv('VUFIND_CACHE_DIR') : LOCAL_OVERRIDE_DIR . '/cache')
);
// Save original working directory in case we need to remember our context, then
// switch to the application directory for convenience:
define('ORIGINAL_WORKING_DIRECTORY', getcwd());
......
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