From 1df58c995c0d9d536b04f4ae2d139034e1ed5948 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 6 Apr 2018 12:53:01 -0400 Subject: [PATCH] Minor channels home improvements: - null coalescing - use cache namespacing --- .../src/VuFind/Controller/ChannelsController.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/module/VuFind/src/VuFind/Controller/ChannelsController.php b/module/VuFind/src/VuFind/Controller/ChannelsController.php index d5f6244ff0b..e29414c0c58 100644 --- a/module/VuFind/src/VuFind/Controller/ChannelsController.php +++ b/module/VuFind/src/VuFind/Controller/ChannelsController.php @@ -78,21 +78,19 @@ class ChannelsController extends AbstractBase public function homeAction() { $config = $this->getConfig('channels'); - $defaultSearchClassId = isset($config->General->default_home_source) - ? $config->General->default_home_source : DEFAULT_SEARCH_BACKEND; + $defaultSearchClassId + = $config->General->default_home_source ?? DEFAULT_SEARCH_BACKEND; $searchClassId = $this->params()->fromQuery('source', $defaultSearchClassId); $providerIds = isset($config->{"source.$searchClassId"}->home) ? $config->{"source.$searchClassId"}->home->toArray() : []; $providers = $this->getChannelProviderArray($providerIds, $config); $token = $this->params()->fromQuery('channelToken'); - if (isset($config->General->cache_home_channels) - && $config->General->cache_home_channels - ) { + if ($config->General->cache_home_channels ?? false) { $parts = [implode(',', $providerIds), $searchClassId, $token]; - $cacheKey = 'homeChannels-' . md5(implode('-', $parts)); + $cacheKey = md5(implode('-', $parts)); $cache = $this->serviceLocator->get('VuFind\Cache\Manager') - ->getCache('object'); + ->getCache('object', 'homeChannels'); } else { $cacheKey = false; } -- GitLab