diff --git a/config/vufind/httpd-vufind.conf b/config/vufind/httpd-vufind.conf index 5fa16bf7710239cf4881c770c419015503b2d619..31b94863c4e9493bc2aa2b632388bf8adf5702ac 100644 --- a/config/vufind/httpd-vufind.conf +++ b/config/vufind/httpd-vufind.conf @@ -75,6 +75,7 @@ Alias /vufind /usr/local/vufind/public # 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. + # If you adjust this, be sure to change the public cache AliasMatch above to match. #SetEnv VUFIND_CACHE_DIR /usr/local/vufind/local/cache # This line specifies additional Zend Framework 2 modules to load after the standard VuFind module. diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php index 24dd1dda5848d478a2a9ceb8dee16470c7feec9a..94b27cdea4acbb2b144db751c0d9eb09ceea642b 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php @@ -194,7 +194,12 @@ trait ConcatTrait */ 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/'; } /** @@ -293,8 +298,13 @@ trait ConcatTrait protected function isPipelineActive() { if ($this->usePipeline) { - $cacheDir = $this->getResourceCacheDir(); - if (!is_writable($cacheDir)) { + try { + $cacheDir = $this->getResourceCacheDir(); + } catch (\Exception $e) { + $this->usePipeline = $cacheDir = false; + error_log($e->getMessage()); + } + if ($cacheDir && !is_writable($cacheDir)) { $this->usePipeline = false; error_log("Cannot write to $cacheDir; disabling asset pipeline."); }