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

Remove hard-coded path for public cache files.

- Respect the VUFIND_LOCAL_CACHE constant.
- Resolves VUFIND-1234.
parent ab6a78d4
Branches
Tags
No related merge requests found
...@@ -75,6 +75,7 @@ Alias /vufind /usr/local/vufind/public ...@@ -75,6 +75,7 @@ Alias /vufind /usr/local/vufind/public
# encounter unexpected side effects -- while this directory may be outside of the # 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, there should be exactly one separate cache location per
# local settings directory. # local settings directory.
# If you adjust this, be sure to change the public cache AliasMatch above to match.
#SetEnv VUFIND_CACHE_DIR /usr/local/vufind/local/cache #SetEnv VUFIND_CACHE_DIR /usr/local/vufind/local/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.
......
...@@ -192,7 +192,12 @@ trait ConcatTrait ...@@ -192,7 +192,12 @@ trait ConcatTrait
*/ */
protected function getResourceCacheDir() protected function getResourceCacheDir()
{ {
return $this->themeInfo->getBaseDir() . '/../local/cache/public/'; if (!defined('LOCAL_CACHE_DIR')) {
throw new \Exception(
'Asset pipeline feature depends on the LOCAL_CACHE_DIR constant.'
);
}
return LOCAL_CACHE_DIR . '/public/';
} }
/** /**
...@@ -291,8 +296,13 @@ trait ConcatTrait ...@@ -291,8 +296,13 @@ trait ConcatTrait
protected function isPipelineActive() protected function isPipelineActive()
{ {
if ($this->usePipeline) { if ($this->usePipeline) {
$cacheDir = $this->getResourceCacheDir(); try {
if (!is_writable($cacheDir)) { $cacheDir = $this->getResourceCacheDir();
} catch (\Exception $e) {
$this->usePipeline = $cacheDir = false;
error_log($e->getMessage());
}
if ($cacheDir && !is_writable($cacheDir)) {
$this->usePipeline = false; $this->usePipeline = false;
error_log("Cannot write to $cacheDir; disabling asset pipeline."); error_log("Cannot write to $cacheDir; disabling asset pipeline.");
} }
......
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