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')) { ...@@ -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 // Set up cache directory (be sure to keep separate cache for CLI vs. web and
// to account for potentially variant environment settings): // to account for potentially variant environment settings):
$baseDir = ($local = getenv('VUFIND_LOCAL_DIR')) ? $local : 'data'; $baseDir = ($local = getenv('VUFIND_LOCAL_DIR')) ? $local : 'data';
$cacheDir = $baseDir . '/cache'; $cacheDir = ($cache = getenv('VUFIND_CACHE_DIR')) ? $cache : $baseDir . '/cache';
if (!is_dir($cacheDir)) { if (!is_dir($cacheDir)) {
mkdir($cacheDir); mkdir($cacheDir);
} }
......
...@@ -1139,16 +1139,12 @@ dewey = title ...@@ -1139,16 +1139,12 @@ dewey = title
HMACkey = mySuperSecretValue HMACkey = mySuperSecretValue
; This section sets global defaults for caches; file caching is used by default. ; 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] ;[Cache]
; Set time to live value for Zend caches (in seconds), 0 means maximum possible. ; Set time to live value for Zend caches (in seconds), 0 means maximum possible.
;ttl = 0 ;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. ; Override umask for cache directories and files.
;umask = 022 ;umask = 022
; Permissions for Zend-created cache directories and files, subject to umask ; Permissions for Zend-created cache directories and files, subject to umask
......
...@@ -57,6 +57,14 @@ Alias /vufind /usr/local/vufind/public ...@@ -57,6 +57,14 @@ Alias /vufind /usr/local/vufind/public
# to override VuFind core features/settings. Set to blank string ("") to disable. # to override VuFind core features/settings. Set to blank string ("") to disable.
SetEnv VUFIND_LOCAL_DIR /usr/local/vufind/local 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. # 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 # Multiple modules may be specified separated by commas. This mechanism can be used to override
# core VuFind functionality without modifying core code. # core VuFind functionality without modifying core code.
......
...@@ -148,11 +148,16 @@ class Manager ...@@ -148,11 +148,16 @@ class Manager
public function getCacheDir($allowCliOverride = true) public function getCacheDir($allowCliOverride = true)
{ {
if ($this->defaults && isset($this->defaults['cache_dir'])) { if ($this->defaults && isset($this->defaults['cache_dir'])) {
$dir = $this->defaults['cache_dir']; // cache_dir setting in config.ini is deprecated
// ensure trailing slash: throw new \Exception(
if (substr($dir, -1) != '/') { 'Deprecated cache_dir setting found in config.ini - please use '
$dir .= '/'; . '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) { } else if (strlen(LOCAL_OVERRIDE_DIR) > 0) {
$dir = LOCAL_OVERRIDE_DIR . '/cache/'; $dir = LOCAL_OVERRIDE_DIR . '/cache/';
} else { } else {
......
...@@ -73,7 +73,8 @@ class CombinedController extends AbstractSearch ...@@ -73,7 +73,8 @@ class CombinedController extends AbstractSearch
$searchClassId = $this->params()->fromQuery('id'); $searchClassId = $this->params()->fromQuery('id');
$config = $this->getServiceLocator()->get('VuFind\Config')->get('combined') $config = $this->getServiceLocator()->get('VuFind\Config')->get('combined')
->toArray(); ->toArray();
if (!isset($config[$searchClassId])) { $tabConfig = $this->getTabConfig($config);
if (!isset($tabConfig[$searchClassId])) {
throw new \Exception('Illegal ID'); throw new \Exception('Illegal ID');
} }
...@@ -83,7 +84,7 @@ class CombinedController extends AbstractSearch ...@@ -83,7 +84,7 @@ class CombinedController extends AbstractSearch
$currentOptions = $options->get($searchClassId); $currentOptions = $options->get($searchClassId);
list($controller, $action) list($controller, $action)
= explode('-', $currentOptions->getSearchAction()); = explode('-', $currentOptions->getSearchAction());
$settings = $config[$searchClassId]; $settings = $tabConfig[$searchClassId];
$this->adjustQueryForSettings($settings); $this->adjustQueryForSettings($settings);
$settings['view'] = $this->forwardTo($controller, $action); $settings['view'] = $this->forwardTo($controller, $action);
...@@ -149,11 +150,7 @@ class CombinedController extends AbstractSearch ...@@ -149,11 +150,7 @@ class CombinedController extends AbstractSearch
->toArray(); ->toArray();
$supportsCart = false; $supportsCart = false;
$supportsCartOptions = []; $supportsCartOptions = [];
foreach ($config as $current => $settings) { foreach ($this->getTabConfig($config) as $current => $settings) {
// Special case -- ignore recommendation config:
if ($current == 'Layout' || $current == 'RecommendationModules') {
continue;
}
$this->adjustQueryForSettings($settings); $this->adjustQueryForSettings($settings);
$currentOptions = $options->get($current); $currentOptions = $options->get($current);
$supportsCartOptions[] = $currentOptions->supportsCart(); $supportsCartOptions[] = $currentOptions->supportsCart();
...@@ -274,4 +271,20 @@ class CombinedController extends AbstractSearch ...@@ -274,4 +271,20 @@ class CombinedController extends AbstractSearch
$query->noRecommend = 'top,side'; $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') ...@@ -33,6 +33,14 @@ defined('LOCAL_OVERRIDE_DIR')
(getenv('VUFIND_LOCAL_DIR') ? getenv('VUFIND_LOCAL_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 // Save original working directory in case we need to remember our context, then
// switch to the application directory for convenience: // switch to the application directory for convenience:
define('ORIGINAL_WORKING_DIRECTORY', getcwd()); 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