From e3cc274b4773199d94bcfa218e132fccf25ac896 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 12 Jun 2018 13:49:28 -0400 Subject: [PATCH] Allow main configuration file to be overridden. --- .../VuFind/src/VuFind/Search/Base/Options.php | 18 ++++++++++++++++++ .../src/VuFind/Search/Favorites/Options.php | 2 +- .../VuFind/src/VuFind/Search/Solr/Options.php | 2 +- .../VuFind/src/VuFind/Search/Solr/Params.php | 2 +- .../VuFind/src/VuFind/Search/Tags/Options.php | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/Base/Options.php b/module/VuFind/src/VuFind/Search/Base/Options.php index 66067027688..9e30bf8e117 100644 --- a/module/VuFind/src/VuFind/Search/Base/Options.php +++ b/module/VuFind/src/VuFind/Search/Base/Options.php @@ -226,6 +226,13 @@ abstract class Options implements TranslatorAwareInterface */ protected $autocompleteEnabled = false; + /** + * Configuration file to read global settings from + * + * @var string + */ + protected $mainIni = 'config'; + /** * Configuration file to read search settings from * @@ -405,6 +412,17 @@ abstract class Options implements TranslatorAwareInterface return $this->facetsIni; } + /** + * Get the name of the ini file used for loading primary settings in this + * object. + * + * @return string + */ + public function getMainIni() + { + return $this->mainIni; + } + /** * Get the name of the ini file used for configuring search parameters in this * object. diff --git a/module/VuFind/src/VuFind/Search/Favorites/Options.php b/module/VuFind/src/VuFind/Search/Favorites/Options.php index f11d416cdea..8c049e62927 100644 --- a/module/VuFind/src/VuFind/Search/Favorites/Options.php +++ b/module/VuFind/src/VuFind/Search/Favorites/Options.php @@ -52,7 +52,7 @@ class Options extends \VuFind\Search\Base\Options 'title' => 'sort_title', 'author' => 'sort_author', 'year DESC' => 'sort_year', 'year' => 'sort_year asc' ]; - $config = $configLoader->get('config'); + $config = $configLoader->get($this->mainIni); if (isset($config->Social->lists_default_limit)) { $this->defaultLimit = $config->Social->lists_default_limit; } diff --git a/module/VuFind/src/VuFind/Search/Solr/Options.php b/module/VuFind/src/VuFind/Search/Solr/Options.php index 236afca7f48..760b81e44b2 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Options.php +++ b/module/VuFind/src/VuFind/Search/Solr/Options.php @@ -186,7 +186,7 @@ class Options extends \VuFind\Search\Base\Options } // Load Spelling preferences - $config = $configLoader->get('config'); + $config = $configLoader->get($this->mainIni); if (isset($config->Spelling->enabled)) { $this->spellcheck = $config->Spelling->enabled; } diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php index fabb58c0acc..06ac6f635ef 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Params.php +++ b/module/VuFind/src/VuFind/Search/Solr/Params.php @@ -402,7 +402,7 @@ class Params extends \VuFind\Search\Base\Params */ public function getQueryIDLimit() { - $config = $this->configLoader->get('config'); + $config = $this->configLoader->get($this->getOptions()->getMainIni()); return isset($config->Index->maxBooleanClauses) ? $config->Index->maxBooleanClauses : 1024; } diff --git a/module/VuFind/src/VuFind/Search/Tags/Options.php b/module/VuFind/src/VuFind/Search/Tags/Options.php index 5fd63400ee3..05dcca63767 100644 --- a/module/VuFind/src/VuFind/Search/Tags/Options.php +++ b/module/VuFind/src/VuFind/Search/Tags/Options.php @@ -54,7 +54,7 @@ class Options extends \VuFind\Search\Base\Options public function __construct(\VuFind\Config\PluginManager $configLoader) { parent::__construct($configLoader); - $config = $configLoader->get('config'); + $config = $configLoader->get($this->mainIni); if (isset($config->Social->show_solr_options_in_tag_search) && $config->Social->show_solr_options_in_tag_search ) { -- GitLab