diff --git a/config/vufind/httpd-vufind.conf b/config/vufind/httpd-vufind.conf index ddbb03a287824c630bafcf56dc6a3a9fc1da8cfe..c79d6d3dba8dc88f4aaf107a44bd461cd33c79dd 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 db948a36f30879645efd1d41731f4f5010583a50..1934722c4426206a451663b73be1252a8b1d98e1 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php @@ -192,7 +192,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/'; } /** @@ -291,8 +296,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."); }