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

Minor channels home improvements:

- null coalescing
- use cache namespacing
parent 1284bf4a
Branches
Tags
No related merge requests found
...@@ -78,21 +78,19 @@ class ChannelsController extends AbstractBase ...@@ -78,21 +78,19 @@ class ChannelsController extends AbstractBase
public function homeAction() public function homeAction()
{ {
$config = $this->getConfig('channels'); $config = $this->getConfig('channels');
$defaultSearchClassId = isset($config->General->default_home_source) $defaultSearchClassId
? $config->General->default_home_source : DEFAULT_SEARCH_BACKEND; = $config->General->default_home_source ?? DEFAULT_SEARCH_BACKEND;
$searchClassId = $this->params()->fromQuery('source', $defaultSearchClassId); $searchClassId = $this->params()->fromQuery('source', $defaultSearchClassId);
$providerIds = isset($config->{"source.$searchClassId"}->home) $providerIds = isset($config->{"source.$searchClassId"}->home)
? $config->{"source.$searchClassId"}->home->toArray() : []; ? $config->{"source.$searchClassId"}->home->toArray() : [];
$providers = $this->getChannelProviderArray($providerIds, $config); $providers = $this->getChannelProviderArray($providerIds, $config);
$token = $this->params()->fromQuery('channelToken'); $token = $this->params()->fromQuery('channelToken');
if (isset($config->General->cache_home_channels) if ($config->General->cache_home_channels ?? false) {
&& $config->General->cache_home_channels
) {
$parts = [implode(',', $providerIds), $searchClassId, $token]; $parts = [implode(',', $providerIds), $searchClassId, $token];
$cacheKey = 'homeChannels-' . md5(implode('-', $parts)); $cacheKey = md5(implode('-', $parts));
$cache = $this->serviceLocator->get('VuFind\Cache\Manager') $cache = $this->serviceLocator->get('VuFind\Cache\Manager')
->getCache('object'); ->getCache('object', 'homeChannels');
} else { } else {
$cacheKey = false; $cacheKey = false;
} }
......
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