diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php index 15c37f72e74..42d01dd91de 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php @@ -71,7 +71,7 @@ public function __invoke( } $handler = new $requestedName( $container->get(\VuFind\Session\Settings::class), - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFind\ILS\Connection::class), $container->get('ViewRenderer'), $container->get(\VuFind\ILS\Logic\Holds::class), diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetRecordCoverFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetRecordCoverFactory.php index ac060a381d0..6f98e453c68 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetRecordCoverFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetRecordCoverFactory.php @@ -67,8 +67,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config - = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $useFallbacks = $config->Content->useCoverFallbacksOnFail ?? false; return new $requestedName( $container->get(\VuFind\Session\Settings::class), diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php index 1e0d00262eb..8f434da58b4 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php @@ -73,7 +73,7 @@ public function __invoke( $container->get(\VuFind\Session\Settings::class), $container->get(\VuFind\Resolver\Driver\PluginManager::class), $container->get('ViewRenderer'), - $container->get(\VuFind\Config\PluginManager::class)->get('config') + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config') ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetSearchResultsFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetSearchResultsFactory.php index 67637681859..93d526687e4 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetSearchResultsFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetSearchResultsFactory.php @@ -77,7 +77,7 @@ public function __invoke( $container->get(\VuFind\Auth\Manager::class)->getUserObject(), $container->get(\Laminas\Session\SessionManager::class)->getId(), $container->get(\VuFind\Search\SearchNormalizer::class), - $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray(), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'), $container->get(\VuFind\Search\Memory::class) ); return $result; diff --git a/module/VuFind/src/VuFind/AjaxHandler/IdentifierLinksLookupFactory.php b/module/VuFind/src/VuFind/AjaxHandler/IdentifierLinksLookupFactory.php index e11e07da239..dfdbf8ec7ad 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/IdentifierLinksLookupFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/IdentifierLinksLookupFactory.php @@ -69,8 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $container->get(\VuFind\IdentifierLinker\PluginManager::class), $container->get('ViewRenderer'), diff --git a/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php b/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php index 55042a4fa68..f74217ab8c4 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php @@ -75,7 +75,7 @@ public function __invoke( return new $requestedName( $container->get(\Laminas\Session\SessionManager::class), $container->get(\VuFind\Search\Results\PluginManager::class), - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $servicePluginManager->get(\VuFind\Db\Service\SessionServiceInterface::class) ); } diff --git a/module/VuFind/src/VuFind/Auth/EmailAuthenticatorFactory.php b/module/VuFind/src/VuFind/Auth/EmailAuthenticatorFactory.php index b698940f29c..c471c6aad76 100644 --- a/module/VuFind/src/VuFind/Auth/EmailAuthenticatorFactory.php +++ b/module/VuFind/src/VuFind/Auth/EmailAuthenticatorFactory.php @@ -73,7 +73,7 @@ public function __invoke( $container->get(\VuFind\Mailer\Mailer::class), $container->get('ViewRenderer'), $container->get(\VuFind\Net\UserIpReader::class), - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFind\Db\Service\PluginManager::class) ->get(\VuFind\Db\Service\AuthHashServiceInterface::class) ); diff --git a/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php b/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php index 87f99faed59..07d3c29c59d 100644 --- a/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php +++ b/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php @@ -87,7 +87,7 @@ function (string $algo) use ($container) { ), $container->get(\VuFind\ILS\Connection::class), $container->get(\VuFind\Auth\EmailAuthenticator::class), - $container->get(\VuFind\Config\PluginManager::class)->get('config') + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config') ); $dbServiceManager = $container->get(DatabaseServiceManager::class); $service->setAuditEventService($dbServiceManager->get(AuditEventServiceInterface::class)); diff --git a/module/VuFind/src/VuFind/Auth/LoginTokenManagerFactory.php b/module/VuFind/src/VuFind/Auth/LoginTokenManagerFactory.php index 8f91f1aa069..60fdab61c9d 100644 --- a/module/VuFind/src/VuFind/Auth/LoginTokenManagerFactory.php +++ b/module/VuFind/src/VuFind/Auth/LoginTokenManagerFactory.php @@ -83,7 +83,7 @@ public function __invoke( $dbServiceManager = $container->get(\VuFind\Db\Service\PluginManager::class); return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $dbServiceManager->get(UserServiceInterface::class), $dbServiceManager->get(LoginTokenServiceInterface::class), $container->get(\VuFind\Cookie\CookieManager::class), diff --git a/module/VuFind/src/VuFind/Auth/ManagerFactory.php b/module/VuFind/src/VuFind/Auth/ManagerFactory.php index 5babe5b1678..84611bab62c 100644 --- a/module/VuFind/src/VuFind/Auth/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Auth/ManagerFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } // Load dependencies: - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $dbServiceManager = $container->get(\VuFind\Db\Service\PluginManager::class); $userService = $dbServiceManager->get(\VuFind\Db\Service\UserServiceInterface::class); $sessionManager = $container->get(\Laminas\Session\SessionManager::class); diff --git a/module/VuFind/src/VuFind/Auth/OpenIDConnectFactory.php b/module/VuFind/src/VuFind/Auth/OpenIDConnectFactory.php index dfb53b33c40..f88372fb46f 100644 --- a/module/VuFind/src/VuFind/Auth/OpenIDConnectFactory.php +++ b/module/VuFind/src/VuFind/Auth/OpenIDConnectFactory.php @@ -74,7 +74,7 @@ public function __invoke( 'OpenIDConnect', $container->get(\Laminas\Session\SessionManager::class) ); - $config = $container->get(\VuFind\Config\PluginManager::class)->get('OpenIDConnectClient')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('OpenIDConnectClient'); $ilsAuthenticator = $container->get(\VuFind\Auth\ILSAuthenticator::class); return new $requestedName($session, $config, $ilsAuthenticator); } diff --git a/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php b/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php index 0b7b898d2bd..841117dad78 100644 --- a/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php +++ b/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php @@ -90,11 +90,11 @@ public function __invoke( */ public function getConfigurationLoader(ContainerInterface $container) { - $configManager = $container->get(\VuFind\Config\PluginManager::class); - $config = $configManager->get('config'); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $config = $configManager->getConfigObject('config'); $override = $config->Shibboleth->allow_configuration_override ?? false; if ($override) { - $shibConfig = $configManager->get(self::SHIBBOLETH_CONFIG_FILE_NAME); + $shibConfig = $configManager->getConfigObject(self::SHIBBOLETH_CONFIG_FILE_NAME); return new MultiIdPConfigurationLoader($config, $shibConfig); } return new SingleIdPConfigurationLoader($config); diff --git a/module/VuFind/src/VuFind/Auth/SimulatedSSOFactory.php b/module/VuFind/src/VuFind/Auth/SimulatedSSOFactory.php index 896c1bcab12..aa5a55ad55b 100644 --- a/module/VuFind/src/VuFind/Auth/SimulatedSSOFactory.php +++ b/module/VuFind/src/VuFind/Auth/SimulatedSSOFactory.php @@ -78,7 +78,7 @@ public function __invoke( $url('simulatedsso-login', [], ['query' => ['return' => $target]]) ); }; - $config = $container->get(\VuFind\Config\PluginManager::class)->get('SimulatedSSO')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('SimulatedSSO'); return new $requestedName( $getUrl, $config, diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php index cd8d69495e6..8ba33553832 100644 --- a/module/VuFind/src/VuFind/Bootstrapper.php +++ b/module/VuFind/src/VuFind/Bootstrapper.php @@ -85,8 +85,7 @@ public function __construct(MvcEvent $event) $app = $event->getApplication(); $this->events = $app->getEventManager(); $this->container = $app->getServiceManager(); - $this->config = $this->container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $this->config = $this->container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); } /** diff --git a/module/VuFind/src/VuFind/Cache/ManagerFactory.php b/module/VuFind/src/VuFind/Cache/ManagerFactory.php index 3e0d879c429..2a3bfd85a03 100644 --- a/module/VuFind/src/VuFind/Cache/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Cache/ManagerFactory.php @@ -68,9 +68,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } + $configManager = $container->get(\VuFind\Config\ConfigManager::class); return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), - $container->get(\VuFind\Config\PluginManager::class)->get('searches'), + $configManager->getConfigObject('config'), + $configManager->getConfigObject('searches'), $container->get(\Laminas\Cache\Service\StorageAdapterFactory::class) ); } diff --git a/module/VuFind/src/VuFind/Captcha/ImageFactory.php b/module/VuFind/src/VuFind/Captcha/ImageFactory.php index 7d7e49eff8b..6611c05b01e 100644 --- a/module/VuFind/src/VuFind/Captcha/ImageFactory.php +++ b/module/VuFind/src/VuFind/Captcha/ImageFactory.php @@ -82,26 +82,25 @@ public function __invoke( 'imgDir' => $cacheOptions->getCacheDir(), ]; - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - - if (isset($config->Captcha->image_length)) { - $imageOptions['wordLen'] = $config->Captcha->image_length; + $config = $container->get(\VuFind\Config\ConfigManager::class) + ->getConfigArray('config')['Captcha'] ?? []; + if (isset($config['image_length'])) { + $imageOptions['wordLen'] = $config['image_length']; } - if (isset($config->Captcha->image_width)) { - $imageOptions['width'] = $config->Captcha->image_width; + if (isset($config['image_width'])) { + $imageOptions['width'] = $config['image_width']; } - if (isset($config->Captcha->image_height)) { - $imageOptions['height'] = $config->Captcha->image_height; + if (isset($config['image_height'])) { + $imageOptions['height'] = $config['image_height']; } - if (isset($config->Captcha->image_fontSize)) { - $imageOptions['fsize'] = $config->Captcha->image_fontSize; + if (isset($config['image_fontSize'])) { + $imageOptions['fsize'] = $config['image_fontSize']; } - if (isset($config->Captcha->image_dotNoiseLevel)) { - $imageOptions['dotNoiseLevel'] = $config->Captcha->image_dotNoiseLevel; + if (isset($config['image_dotNoiseLevel'])) { + $imageOptions['dotNoiseLevel'] = $config['image_dotNoiseLevel']; } - if (isset($config->Captcha->image_lineNoiseLevel)) { - $imageOptions['lineNoiseLevel'] = $config->Captcha->image_lineNoiseLevel; + if (isset($config['image_lineNoiseLevel'])) { + $imageOptions['lineNoiseLevel'] = $config['image_lineNoiseLevel']; } $baseUrl = rtrim( diff --git a/module/VuFind/src/VuFind/Captcha/IntervalFactory.php b/module/VuFind/src/VuFind/Captcha/IntervalFactory.php index eba2c0b5dcc..758df9fe71e 100644 --- a/module/VuFind/src/VuFind/Captcha/IntervalFactory.php +++ b/module/VuFind/src/VuFind/Captcha/IntervalFactory.php @@ -75,7 +75,7 @@ public function __invoke( ); return new $requestedName( $sessionStorage, - $container->get(\VuFind\Config\PluginManager::class)->get('config') + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config') ); } } diff --git a/module/VuFind/src/VuFind/CartFactory.php b/module/VuFind/src/VuFind/CartFactory.php index a6d9a4157b1..d5e951c3c5b 100644 --- a/module/VuFind/src/VuFind/CartFactory.php +++ b/module/VuFind/src/VuFind/CartFactory.php @@ -68,18 +68,13 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $active = isset($config->Site->showBookBag) - ? (bool)$config->Site->showBookBag : false; - $size = $config->Site->bookBagMaxSize ?? 100; - $activeInSearch = $config->Site->bookbagTogglesInSearch ?? true; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config')['Site']; return new $requestedName( $container->get(\VuFind\Record\Loader::class), $container->get(\VuFind\Cookie\CookieManager::class), - $size, - $active, - $activeInSearch + $config['bookBagMaxSize'] ?? 100, + $config['showBookBag'] ?? false, + $config['bookbagTogglesInSearch'] ?? true ); } } diff --git a/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php b/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php index 1b6b2fe6299..9d2df6fdbe5 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php +++ b/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php @@ -70,7 +70,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory!'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('channels'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('channels'), $container->get(\VuFind\Cache\Manager::class), $container->get(\VuFind\ChannelProvider\PluginManager::class), $container->get(\VuFind\Search\SearchRunner::class), diff --git a/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php b/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php index 25e19c3b98b..bafac27bfe7 100644 --- a/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php +++ b/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), // Pass a callback to return the auth manager to prevent circular dependencies // (we need the auth manager to determine some capabilities, but some of its // dependencies may need to make capability checks as well). diff --git a/module/VuFind/src/VuFind/Connection/LibGuidesFactory.php b/module/VuFind/src/VuFind/Connection/LibGuidesFactory.php index 7a719bf32da..99c061258da 100644 --- a/module/VuFind/src/VuFind/Connection/LibGuidesFactory.php +++ b/module/VuFind/src/VuFind/Connection/LibGuidesFactory.php @@ -70,8 +70,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('LibGuidesAPI'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('LibGuidesAPI'); if (!isset($config->General->client_id)) { throw new \Exception('client_id key missing from configuration.'); } diff --git a/module/VuFind/src/VuFind/Connection/RelaisFactory.php b/module/VuFind/src/VuFind/Connection/RelaisFactory.php index b2c8bbf62b2..415149b9909 100644 --- a/module/VuFind/src/VuFind/Connection/RelaisFactory.php +++ b/module/VuFind/src/VuFind/Connection/RelaisFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $url = $config->Relais->authenticateurl ?? null; $client = $container->get(\VuFindHttp\HttpService::class) ->createClient($url); diff --git a/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php b/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php index 0763b3a6b71..74a28ef0d2a 100644 --- a/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php +++ b/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php @@ -70,8 +70,7 @@ public function __invoke( if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); // Special case: if the class name ends in Plus, we need to strip off // the "Plus" and instead configure the base Syndetics class into "plus" @@ -81,9 +80,9 @@ public function __invoke( ? substr($requestedName, 0, strlen($requestedName) - 4) : $requestedName; return new $className( - isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl, + $config['Syndetics']['use_ssl'] ?? false, $plus, - $config->Syndetics->timeout ?? 10 + $config['Syndetics']['timeout'] ?? 10 ); } } diff --git a/module/VuFind/src/VuFind/Content/Covers/BooksiteFactory.php b/module/VuFind/src/VuFind/Content/Covers/BooksiteFactory.php index 835686b4e45..4674e7777f9 100644 --- a/module/VuFind/src/VuFind/Content/Covers/BooksiteFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/BooksiteFactory.php @@ -69,12 +69,11 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $url = $config->Booksite->url ?? 'https://api.booksite.com'; - if (!isset($config->Booksite->key)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $url = $config['Booksite']['url'] ?? 'https://api.booksite.com'; + if (!isset($config['Booksite']['key'])) { throw new \Exception("Booksite 'key' not set in VuFind config"); } - return new $requestedName($url, $config->Booksite->key); + return new $requestedName($url, $config['Booksite']['key']); } } diff --git a/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php b/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php index 8e38a8416d8..77e29636d2a 100644 --- a/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php @@ -69,7 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('BrowZine')?->toArray() ?? []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('BrowZine'); $defaultIgnoreList = ['https://assets.thirdiron.com/default-journal-cover.png']; $ignoreList = $config['Covers']['ignored_images'] ?? $defaultIgnoreList; return new $requestedName($container->get(\VuFindSearch\Service::class), $ignoreList); diff --git a/module/VuFind/src/VuFind/Content/Covers/BuchhandelFactory.php b/module/VuFind/src/VuFind/Content/Covers/BuchhandelFactory.php index 7b44e89284d..17b0c10b6fd 100644 --- a/module/VuFind/src/VuFind/Content/Covers/BuchhandelFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/BuchhandelFactory.php @@ -69,14 +69,13 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $url = isset($config->Buchhandel->url) - ? trim($config->Buchhandel->url, '/') . '/' + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $url = isset($config['Buchhandel']['url']) + ? trim($config['Buchhandel']['url'], '/') . '/' : 'https://api.vlb.de/api/v1/cover/'; - if (!isset($config->Buchhandel->token)) { + if (!isset($config['Buchhandel']['token'])) { throw new \Exception("Buchhandel.de 'token' not set in VuFind config"); } - return new $requestedName($url, $config->Buchhandel->token); + return new $requestedName($url, $config['Buchhandel']['token']); } } diff --git a/module/VuFind/src/VuFind/Content/Covers/ContentCafeFactory.php b/module/VuFind/src/VuFind/Content/Covers/ContentCafeFactory.php index cd6347f3869..0787aeac483 100644 --- a/module/VuFind/src/VuFind/Content/Covers/ContentCafeFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/ContentCafeFactory.php @@ -69,8 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $finalConfig = $config->Contentcafe ?? new \VuFind\Config\Config([]); return new $requestedName($finalConfig); } diff --git a/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php b/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php index 109e4d1494a..f1e7bd3e015 100644 --- a/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php @@ -69,11 +69,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - if (empty($config->Content->koha_cover_url)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + if (empty($config['Content']['koha_cover_url'])) { throw new \Exception('Koha cover URL must be provided.'); } - return new $requestedName($config->Content->koha_cover_url); + return new $requestedName($config['Content']['koha_cover_url']); } } diff --git a/module/VuFind/src/VuFind/Content/Covers/OrbFactory.php b/module/VuFind/src/VuFind/Content/Covers/OrbFactory.php index 551cb4fe99f..05445de9d49 100644 --- a/module/VuFind/src/VuFind/Content/Covers/OrbFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/OrbFactory.php @@ -69,16 +69,15 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $configPluginManager = $container->get(\VuFind\Config\PluginManager::class); - $config = $configPluginManager->get('config'); - $url = $config->Orb->url ?? 'api.base-orb.fr/v1'; - if (!isset($config->Orb->user)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $url = $config['Orb']['url'] ?? 'api.base-orb.fr/v1'; + if (!isset($config['Orb']['user'])) { throw new \Exception("Orb 'user' not set in VuFind config"); } - if (!isset($config->Orb->key)) { + if (!isset($config['Orb']['key'])) { throw new \Exception("Orb 'key' not set in VuFind config"); } - $orb = new $requestedName($url, $config->Orb->user, $config->Orb->key); + $orb = new $requestedName($url, $config['Orb']['user'], $config['Orb']['key']); $cachingDownloader = $container->get(\VuFind\Http\CachingDownloader::class); $orb->setCachingDownloader($cachingDownloader); return $orb; diff --git a/module/VuFind/src/VuFind/Content/Covers/SyndeticsFactory.php b/module/VuFind/src/VuFind/Content/Covers/SyndeticsFactory.php index 27b6a267c53..7ae7ae9540b 100644 --- a/module/VuFind/src/VuFind/Content/Covers/SyndeticsFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/SyndeticsFactory.php @@ -69,8 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $syndetics = new $requestedName($config->Syndetics ?? null); $cachingDownloader = $container->get(\VuFind\Http\CachingDownloader::class); $syndetics->setCachingDownloader($cachingDownloader); diff --git a/module/VuFind/src/VuFind/Content/Factory.php b/module/VuFind/src/VuFind/Content/Factory.php index ba32bc35b95..859e8802165 100644 --- a/module/VuFind/src/VuFind/Content/Factory.php +++ b/module/VuFind/src/VuFind/Content/Factory.php @@ -102,10 +102,9 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } $pm = $container->get($this->getPluginManagerServiceName($requestedName)); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $setting = $this->getConfigSettingName($requestedName); - $providers = $config->Content->$setting ?? ''; + $providers = $config['Content'][$setting] ?? ''; return new Loader($pm, $providers); } } diff --git a/module/VuFind/src/VuFind/Content/ObalkyKnihServiceFactory.php b/module/VuFind/src/VuFind/Content/ObalkyKnihServiceFactory.php index 0527c435df0..d6ede0dfeef 100644 --- a/module/VuFind/src/VuFind/Content/ObalkyKnihServiceFactory.php +++ b/module/VuFind/src/VuFind/Content/ObalkyKnihServiceFactory.php @@ -70,8 +70,7 @@ public function __invoke( 'Unexpected options passed to factory.' ); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('obalkyknih'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('obalkyknih'); if (!isset($config->ObalkyKnih)) { throw new ServiceNotCreatedException( 'ObalkyKnih service is not properly configured' diff --git a/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php b/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php index e87e34a2dd6..fe29152e9c6 100644 --- a/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php +++ b/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php @@ -67,12 +67,11 @@ public function __invoke( if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $url = $config->Booksite->url ?? 'https://api.booksite.com'; - if (!isset($config->Booksite->key)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $url = $config['Booksite']['url'] ?? 'https://api.booksite.com'; + if (!isset($config['Booksite']['key'])) { throw new \Exception("Booksite 'key' not set in VuFind config"); } - return new $requestedName($url, $config->Booksite->key); + return new $requestedName($url, $config['Booksite']['key']); } } diff --git a/module/VuFind/src/VuFind/Controller/AbstractBase.php b/module/VuFind/src/VuFind/Controller/AbstractBase.php index 63c225f3547..eee846b9772 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBase.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBase.php @@ -462,7 +462,7 @@ protected function catalogLogin() */ public function getConfig($id = 'config') { - return $this->getService(\VuFind\Config\PluginManager::class)->get($id); + return $this->getService(\VuFind\Config\ConfigManager::class)->getConfigObject($id); } /** diff --git a/module/VuFind/src/VuFind/Controller/AbstractBaseFactory.php b/module/VuFind/src/VuFind/Controller/AbstractBaseFactory.php index 1eea3545029..80d30adef65 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBaseFactory.php @@ -56,9 +56,8 @@ class AbstractBaseFactory implements FactoryInterface */ protected function applyPermissions($container, $controller) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('permissionBehavior'); - $permissions = $config->global->controllerAccess ?? []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('permissionBehavior'); + $permissions = $config['global']['controllerAccess'] ?? []; if (!empty($permissions) && $controller instanceof Feature\AccessPermissionInterface) { // Iterate through parent classes until we find the most specific diff --git a/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php b/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php index fe88f4fd654..43b51902434 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php @@ -67,8 +67,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return $this->applyPermissions( $container, new $requestedName($container, $config) diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index bcd007660cc..71e2db63ab0 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -670,10 +670,8 @@ protected function getRangeSettings($fields, $type, $savedSearch = false) */ protected function getRangeFieldList($config, $section, $filter) { - $config = $this->getService(\VuFind\Config\PluginManager::class) - ->get($config); - $fields = isset($config->SpecialFacets->$section) - ? $config->SpecialFacets->$section->toArray() : []; + $config = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigArray($config); + $fields = $config['SpecialFacets'][$section] ?? []; if (!empty($filter)) { $fields = array_intersect($fields, $filter); @@ -842,8 +840,7 @@ protected function processAdvancedCheckboxes($params, $savedSearch = false) $section = $params[1] ?? 'CheckboxFacets'; // Load config file: - $config = $this->getService(\VuFind\Config\PluginManager::class) - ->get($config); + $config = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigArray($config); // Process checkbox settings in config: $flipCheckboxes = false; @@ -851,8 +848,7 @@ protected function processAdvancedCheckboxes($params, $savedSearch = false) $section = substr($section, 1); $flipCheckboxes = true; } - $checkboxFacets = ($section && isset($config->$section)) - ? $config->$section->toArray() : []; + $checkboxFacets = ($section && isset($config[$section])) ? $config[$section] : []; if ($flipCheckboxes) { $checkboxFacets = array_flip($checkboxFacets); } @@ -913,8 +909,8 @@ public function facetListAction() ? 'count' : current(array_keys($facetSortOptions)); } - $config = $this->getService(\VuFind\Config\PluginManager::class) - ->get($options->getFacetsIni()); + $config = $this->getService(\VuFind\Config\ConfigManager::class) + ->getConfigObject($options->getFacetsIni()); $limit = $config->Results_Settings->lightboxLimit ?? 50; $limit = $this->params()->fromQuery('facetlimit', $limit); if (!empty($contains)) { diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php index fff92bb4199..fc607b1b867 100644 --- a/module/VuFind/src/VuFind/Controller/CombinedController.php +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -205,7 +205,7 @@ public function resultsAction() $results->performAndProcessSearch(); $actualMaxColumns = count($combinedResults); - $config = $this->getService(\VuFind\Config\PluginManager::class)->get('combined')->toArray(); + $config = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigArray('combined'); $columnConfig = intval($config['Layout']['columns'] ?? $actualMaxColumns); $columns = min($columnConfig, $actualMaxColumns); $placement = $config['Layout']['stack_placement'] ?? 'distributed'; diff --git a/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php b/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php index c05bba47a64..0cba33ae2cb 100644 --- a/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php @@ -68,13 +68,12 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); - $configArray = $config?->Content?->toArray() ?? []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Content'] ?? []; return new $requestedName( $container->get(\VuFind\Cover\Loader::class), $container->get(\VuFind\Cover\CachingProxy::class), $container->get(\VuFind\Session\Settings::class), - $configArray + $config ); } } diff --git a/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php b/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php index 73708a8ba42..d36563eaad6 100644 --- a/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $authManager = $container->get(\VuFind\Auth\Manager::class); return new $requestedName($config, $authManager); } diff --git a/module/VuFind/src/VuFind/Controller/Plugin/CaptchaFactory.php b/module/VuFind/src/VuFind/Controller/Plugin/CaptchaFactory.php index 52c92ac7ef4..8606720ec8d 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/CaptchaFactory.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/CaptchaFactory.php @@ -71,8 +71,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $captchaTypes = $config->Captcha->types ?? []; diff --git a/module/VuFind/src/VuFind/Controller/Plugin/IlsRecordsFactory.php b/module/VuFind/src/VuFind/Controller/Plugin/IlsRecordsFactory.php index 4e273e99993..622ffe4ad68 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/IlsRecordsFactory.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/IlsRecordsFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFind\Record\Loader::class) ); } diff --git a/module/VuFind/src/VuFind/Controller/Plugin/NewItemsFactory.php b/module/VuFind/src/VuFind/Controller/Plugin/NewItemsFactory.php index 81767795024..b622afe87df 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/NewItemsFactory.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/NewItemsFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } $search - = $container->get(\VuFind\Config\PluginManager::class)->get('searches'); + = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('searches'); $config = $search->NewItem ?? new \VuFind\Config\Config([]); return new $requestedName($config); } diff --git a/module/VuFind/src/VuFind/Controller/Plugin/ReservesFactory.php b/module/VuFind/src/VuFind/Controller/Plugin/ReservesFactory.php index 5be43091b76..db3e3280344 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/ReservesFactory.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/ReservesFactory.php @@ -68,9 +68,8 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config - = $container->get(\VuFind\Config\PluginManager::class)->get('config'); - $useIndex = $config->Reserves->search_enabled ?? false; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $useIndex = $config['Reserves']['search_enabled'] ?? false; $ss = $useIndex ? $container->get(\VuFindSearch\Service::class) : null; return new $requestedName($useIndex, $ss); } diff --git a/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php b/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php index 1c8c7509883..aa42d5138ee 100644 --- a/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php +++ b/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php @@ -71,21 +71,20 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Cookies'] ?? []; $path = '/'; - if ($config->Cookies->limit_by_path ?? false) { + if ($config['limit_by_path'] ?? false) { $path = (PHP_SAPI == 'cli') ? '' : $container->get('Request')->getBasePath(); if (empty($path)) { $path = '/'; } } - $secure = $config->Cookies->only_secure ?? false; - $httpOnly = $config->Cookies->http_only ?? true; - $domain = $config->Cookies->domain ?? null; - $sessionName = $config->Cookies->session_name ?? null; - $sameSite = $config->Cookies->sameSite ?? 'Lax'; + $secure = $config['only_secure'] ?? false; + $httpOnly = $config['http_only'] ?? true; + $domain = $config['domain'] ?? null; + $sessionName = $config['session_name'] ?? null; + $sameSite = $config['sameSite'] ?? 'Lax'; return new $requestedName( $_COOKIE, $path, diff --git a/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php b/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php index b2b82a6b703..29928cf9e53 100644 --- a/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php +++ b/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php @@ -74,8 +74,7 @@ public function __invoke( ->getCache('cover')->getOptions(); $cacheDir = is_callable([$cacheOptions, 'getCacheDir']) ? $cacheOptions->getCacheDir() : null; - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config') - ->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $allowedHosts = isset($config['Content']['coverproxyCache']) ? (array)$config['Content']['coverproxyCache'] : []; return new $requestedName( diff --git a/module/VuFind/src/VuFind/Cover/LoaderFactory.php b/module/VuFind/src/VuFind/Cover/LoaderFactory.php index 7533cba6eb9..a867d47e6f2 100644 --- a/module/VuFind/src/VuFind/Cover/LoaderFactory.php +++ b/module/VuFind/src/VuFind/Cover/LoaderFactory.php @@ -74,8 +74,7 @@ public function __invoke( ->getCache('cover')->getOptions(); $cacheDir = is_callable([$cacheOptions, 'getCacheDir']) ? $cacheOptions->getCacheDir() : null; - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $loader = new $requestedName( $config, $container->get(\VuFind\Content\Covers\PluginManager::class), diff --git a/module/VuFind/src/VuFind/Cover/RouterFactory.php b/module/VuFind/src/VuFind/Cover/RouterFactory.php index 579e1320cf7..73b02dc53cb 100644 --- a/module/VuFind/src/VuFind/Cover/RouterFactory.php +++ b/module/VuFind/src/VuFind/Cover/RouterFactory.php @@ -77,7 +77,7 @@ public function __invoke( $base = ($container->get('ViewRenderer')->plugin('url'))('cover-show'); } $coverLoader = $container->get(\VuFind\Cover\Loader::class); - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray()['Content'] ?? []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Content'] ?? []; return new $requestedName($base, $coverLoader, $config); } } diff --git a/module/VuFind/src/VuFind/Crypt/BlockCipherFactory.php b/module/VuFind/src/VuFind/Crypt/BlockCipherFactory.php index 3daed040d24..ff580f97ccf 100644 --- a/module/VuFind/src/VuFind/Crypt/BlockCipherFactory.php +++ b/module/VuFind/src/VuFind/Crypt/BlockCipherFactory.php @@ -68,7 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $options = ['legacyPbkdf2' => $config['Security']['legacyPbkdf2'] ?? true]; return new $requestedName($options); } diff --git a/module/VuFind/src/VuFind/Crypt/HMACFactory.php b/module/VuFind/src/VuFind/Crypt/HMACFactory.php index c516293cd1c..a5bb8afb4d1 100644 --- a/module/VuFind/src/VuFind/Crypt/HMACFactory.php +++ b/module/VuFind/src/VuFind/Crypt/HMACFactory.php @@ -34,6 +34,7 @@ use Laminas\ServiceManager\Factory\FactoryInterface; use Psr\Container\ContainerExceptionInterface as ContainerException; use Psr\Container\ContainerInterface; +use VuFind\Exception\BadConfig; /** * HMAC factory. @@ -68,8 +69,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - return new $requestedName($config->Security->HMACkey); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + if (!isset($config['Security']['HMACkey'])) { + throw new BadConfig('Security HMACkey is not set.'); + } + return new $requestedName($config['Security']['HMACkey']); } } diff --git a/module/VuFind/src/VuFind/Db/ConnectionFactory.php b/module/VuFind/src/VuFind/Db/ConnectionFactory.php index eda2357c240..4b4cc2a526f 100644 --- a/module/VuFind/src/VuFind/Db/ConnectionFactory.php +++ b/module/VuFind/src/VuFind/Db/ConnectionFactory.php @@ -112,8 +112,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $this->config = $container->get(\VuFind\Config\PluginManager::class) - ->get($this->configName); + $this->config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject($this->configName); $this->container = $container; return $this->getConnection(); } diff --git a/module/VuFind/src/VuFind/Db/ConnectionFactoryFactory.php b/module/VuFind/src/VuFind/Db/ConnectionFactoryFactory.php index aecf835efe1..c42941b35a7 100644 --- a/module/VuFind/src/VuFind/Db/ConnectionFactoryFactory.php +++ b/module/VuFind/src/VuFind/Db/ConnectionFactoryFactory.php @@ -65,7 +65,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($config, $container, ...($options ?: [])); } } diff --git a/module/VuFind/src/VuFind/Db/PersistenceManagerFactory.php b/module/VuFind/src/VuFind/Db/PersistenceManagerFactory.php index 99a403a4f85..26beb964333 100644 --- a/module/VuFind/src/VuFind/Db/PersistenceManagerFactory.php +++ b/module/VuFind/src/VuFind/Db/PersistenceManagerFactory.php @@ -66,10 +66,10 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $this->getEntityManager($container), - (bool)($config->Authentication->privacy ?? false), + (bool)($config['Authentication']['privacy'] ?? false), ...($options ?? []) ); } diff --git a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php index f4f97d00596..71cbe273276 100644 --- a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php +++ b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php @@ -74,9 +74,9 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory!'); } - $configManager = $container->get(\VuFind\Config\PluginManager::class); - $config = $configManager->get('config'); - $odConfig = $configManager->get('Overdrive'); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $config = $configManager->getConfigObject('config'); + $odConfig = $configManager->getConfigObject('Overdrive'); // Allow simulated connection if configured: if ($odConfig->API->simulateConnection ?? false) { diff --git a/module/VuFind/src/VuFind/Escaper/EscaperFactory.php b/module/VuFind/src/VuFind/Escaper/EscaperFactory.php index c196f97004f..7247e47810e 100644 --- a/module/VuFind/src/VuFind/Escaper/EscaperFactory.php +++ b/module/VuFind/src/VuFind/Escaper/EscaperFactory.php @@ -68,7 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); - return new $requestedName((bool)($config->Site->extendedHtmlAttributeEscaping ?? false)); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + return new $requestedName((bool)($config['Site']['extendedHtmlAttributeEscaping'] ?? false)); } } diff --git a/module/VuFind/src/VuFind/ExportFactory.php b/module/VuFind/src/VuFind/ExportFactory.php index e5fc10aaa79..d4951692d4a 100644 --- a/module/VuFind/src/VuFind/ExportFactory.php +++ b/module/VuFind/src/VuFind/ExportFactory.php @@ -68,9 +68,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } + $configManager = $container->get(\VuFind\Config\ConfigManager::class); return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray(), - $container->get(\VuFind\Config\PluginManager::class)->get('export')->toArray(), + $configManager->getConfigArray('config'), + $configManager->getConfigArray('export'), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/Form/FormFactory.php b/module/VuFind/src/VuFind/Form/FormFactory.php index 39572c6b7b3..c5679ee6b3d 100644 --- a/module/VuFind/src/VuFind/Form/FormFactory.php +++ b/module/VuFind/src/VuFind/Form/FormFactory.php @@ -69,8 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $yamlReader = $container->get(\VuFind\Config\YamlReader::class); $viewHelperManager = $container->get('ViewHelperManager'); $handlerManager = $container->get(\VuFind\Form\Handler\PluginManager::class); diff --git a/module/VuFind/src/VuFind/Form/Handler/EmailFactory.php b/module/VuFind/src/VuFind/Form/Handler/EmailFactory.php index 0cde8e47492..b643a404dad 100644 --- a/module/VuFind/src/VuFind/Form/Handler/EmailFactory.php +++ b/module/VuFind/src/VuFind/Form/Handler/EmailFactory.php @@ -73,7 +73,7 @@ public function __invoke( return new $requestedName( $container->get('ViewRenderer'), - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFind\Mailer\Mailer::class) ); } diff --git a/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php b/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php index 528e3aca9f7..e7dd02e6c94 100644 --- a/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php @@ -69,14 +69,14 @@ public function __invoke( $parts = explode('\\', $requestedName); $config = end($parts); // Set up options based on global VuFind settings: - $configReader = $container->get(\VuFind\Config\PluginManager::class); - $globalConfig = $configReader->get('config'); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $globalConfig = $configManager->getConfigArray('config'); $options = [ - 'enabled' => $globalConfig->Hierarchy->showTree ?? false, + 'enabled' => $globalConfig['Hierarchy']['showTree'] ?? false, ]; // Load driver-specific configuration: - $driverConfig = $configReader->get($config); + $driverConfig = $configManager->getConfigObject($config); // Build object: return new ConfigurationBased( diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/AbstractBaseFactory.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/AbstractBaseFactory.php index ffb1f25e4f5..a00289dc680 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/AbstractBaseFactory.php @@ -69,8 +69,8 @@ public function __invoke( if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); - $treeDataFormatter = new $requestedName($config->Hierarchy->validateHierarchySequences ?? true); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $treeDataFormatter = new $requestedName($config['Hierarchy']['validateHierarchySequences'] ?? true); $treeDataFormatter->setSorter($container->get(\VuFind\I18n\Sorter::class)); return $treeDataFormatter; } diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php index f8a39ccc234..95342759dec 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php @@ -76,14 +76,9 @@ public function __invoke( } $cacheDir = $container->get(\VuFind\Cache\Manager::class) ->getCacheDir(false); - $hierarchyFilters = $container->get(\VuFind\Config\PluginManager::class) - ->get('HierarchyDefault'); - $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) - ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() - : []; - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $batchSize = $config->Index->cursor_batch_size ?? 1000; + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $filters = $configManager->getConfigArray('HierarchyDefault')['HierarchyTree']['filterQueries'] ?? []; + $batchSize = $configManager->getConfigArray('config')['Index']['cursor_batch_size'] ?? 1000; $searchService = $container->get(\VuFindSearch\Service::class); $formatterManager = $container ->get(\VuFind\Hierarchy\TreeDataFormatter\PluginManager::class); diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/HTMLTreeFactory.php b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/HTMLTreeFactory.php index a912e0b7a74..b95d49a3ddb 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/HTMLTreeFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/HTMLTreeFactory.php @@ -67,11 +67,10 @@ public function __invoke( if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $container->get('ControllerPluginManager')->get('Url'), - !empty($config->Collections->collections), + !empty($config['Collections']['collections']), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/Http/CachingDownloaderFactory.php b/module/VuFind/src/VuFind/Http/CachingDownloaderFactory.php index 2ca4e692b1d..a32ad4ab4f3 100644 --- a/module/VuFind/src/VuFind/Http/CachingDownloaderFactory.php +++ b/module/VuFind/src/VuFind/Http/CachingDownloaderFactory.php @@ -70,10 +70,11 @@ public function __invoke( } $configManager = $container->get(\VuFind\Config\PluginManager::class); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $container->get(\VuFind\Cache\Manager::class), $configManager, - !($configManager->get('config')->CachingDownloader->disabled ?? false) + !($config['CachingDownloader']['disabled'] ?? false) ); } } diff --git a/module/VuFind/src/VuFind/Http/GuzzleServiceFactory.php b/module/VuFind/src/VuFind/Http/GuzzleServiceFactory.php index f84fb0182f4..c41fd417a9e 100644 --- a/module/VuFind/src/VuFind/Http/GuzzleServiceFactory.php +++ b/module/VuFind/src/VuFind/Http/GuzzleServiceFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray() + $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config') ); } } diff --git a/module/VuFind/src/VuFind/I18n/SorterFactory.php b/module/VuFind/src/VuFind/I18n/SorterFactory.php index cf3d03245be..e773df9e7de 100644 --- a/module/VuFind/src/VuFind/I18n/SorterFactory.php +++ b/module/VuFind/src/VuFind/I18n/SorterFactory.php @@ -73,13 +73,11 @@ public function __invoke( } $localeSettings = $container->get(LocaleSettings::class); $collator = new \Collator($localeSettings->getUserLocale()); - $config = $container - ->get(\VuFind\Config\PluginManager::class) - ->get('config')->Sorting; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $collator->setStrength(\Collator::SECONDARY); return new $requestedName( $collator, - (bool)($config->use_locale_sorting ?? false) + (bool)($config['Sorting']['use_locale_sorting'] ?? false) ); } } diff --git a/module/VuFind/src/VuFind/ILS/ConnectionFactory.php b/module/VuFind/src/VuFind/ILS/ConnectionFactory.php index 1d98bc62634..229efe63bda 100644 --- a/module/VuFind/src/VuFind/ILS/ConnectionFactory.php +++ b/module/VuFind/src/VuFind/ILS/ConnectionFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $configManager = $container->get(\VuFind\Config\PluginManager::class); - $config = $configManager->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $request = $container->get('Request'); $catalog = new $requestedName( $config->Catalog, diff --git a/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php b/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php index d26569d4e85..0c19f310316 100644 --- a/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php +++ b/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php @@ -68,9 +68,9 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $configManager = $container->get(\VuFind\Config\PluginManager::class); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); return new $requestedName( - $configManager->get('config')->Catalog + $configManager->getConfigObject('config')->Catalog ); } } diff --git a/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php b/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php index 0946a3c7738..76b487a180c 100644 --- a/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php +++ b/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php @@ -72,7 +72,7 @@ public function __invoke( $container->get(\VuFind\Auth\ILSAuthenticator::class), $container->get(\VuFind\ILS\Connection::class), $container->get(\VuFind\Crypt\HMAC::class), - $container->get(\VuFind\Config\PluginManager::class)->get('config') + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config') ); } } diff --git a/module/VuFind/src/VuFind/IdentifierLinker/BrowZineFactory.php b/module/VuFind/src/VuFind/IdentifierLinker/BrowZineFactory.php index b1eaff34ccf..04c1d1deebc 100644 --- a/module/VuFind/src/VuFind/IdentifierLinker/BrowZineFactory.php +++ b/module/VuFind/src/VuFind/IdentifierLinker/BrowZineFactory.php @@ -107,7 +107,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } $search = $container->get(\VuFindSearch\Service::class); - $fullConfig = $container->get(\VuFind\Config\PluginManager::class)->get('BrowZine')->toArray(); + $fullConfig = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('BrowZine'); // DOI config section is supported as a fallback for legacy back-compatibility: $config = $fullConfig['IdentifierLinks'] ?? $fullConfig['DOI'] ?? []; diff --git a/module/VuFind/src/VuFind/IdentifierLinker/UnpaywallFactory.php b/module/VuFind/src/VuFind/IdentifierLinker/UnpaywallFactory.php index 204631d26c0..4af468b87a2 100644 --- a/module/VuFind/src/VuFind/IdentifierLinker/UnpaywallFactory.php +++ b/module/VuFind/src/VuFind/IdentifierLinker/UnpaywallFactory.php @@ -69,8 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config')->DOI; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config')->DOI; return new $requestedName($config); } } diff --git a/module/VuFind/src/VuFind/Log/LoggerFactory.php b/module/VuFind/src/VuFind/Log/LoggerFactory.php index e92e132c652..b561d48dd22 100644 --- a/module/VuFind/src/VuFind/Log/LoggerFactory.php +++ b/module/VuFind/src/VuFind/Log/LoggerFactory.php @@ -259,8 +259,7 @@ protected function hasDynamicDebug(ContainerInterface $container): bool */ protected function configureLogger(ContainerInterface $container, Logger $logger) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); // Add a no-op writer so fatal errors are not triggered if log messages are // sent during the initialization process. diff --git a/module/VuFind/src/VuFind/Mailer/Factory.php b/module/VuFind/src/VuFind/Mailer/Factory.php index 24f5219a4ca..05a46f1c094 100644 --- a/module/VuFind/src/VuFind/Mailer/Factory.php +++ b/module/VuFind/src/VuFind/Mailer/Factory.php @@ -124,7 +124,7 @@ public function __invoke( } // Load configurations: - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); // Create service: $class = new $requestedName( diff --git a/module/VuFind/src/VuFind/Navigation/AccountMenuFactory.php b/module/VuFind/src/VuFind/Navigation/AccountMenuFactory.php index 6d5d674e8ac..c051edc1b33 100644 --- a/module/VuFind/src/VuFind/Navigation/AccountMenuFactory.php +++ b/module/VuFind/src/VuFind/Navigation/AccountMenuFactory.php @@ -65,11 +65,9 @@ public function __invoke( ?array $options = null ) { // Only load the connector if we need to show - $config = $container->get(\VuFind\Config\PluginManager::class)->get( - 'Overdrive' - ); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('Overdrive'); $connector = null; - if ($config->Overdrive->showMyContent != 'never') { + if (($config['Overdrive']['showMyContent'] ?? '') != 'never') { $connector = $container->get( \VuFind\DigitalContent\OverdriveConnector::class ); diff --git a/module/VuFind/src/VuFind/Navigation/AdminMenuFactory.php b/module/VuFind/src/VuFind/Navigation/AdminMenuFactory.php index d3155baccee..0b7b0e9d177 100644 --- a/module/VuFind/src/VuFind/Navigation/AdminMenuFactory.php +++ b/module/VuFind/src/VuFind/Navigation/AdminMenuFactory.php @@ -64,14 +64,13 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('Overdrive'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('Overdrive'); return parent::__invoke( $container, $requestedName, [ 'AdminMenu.yaml', - $config->Overdrive->showOverdriveAdminMenu ?? false, + $config['Overdrive']['showOverdriveAdminMenu'] ?? false, ] ); } diff --git a/module/VuFind/src/VuFind/Net/UserIpReaderFactory.php b/module/VuFind/src/VuFind/Net/UserIpReaderFactory.php index acfd5db0602..385864d2deb 100644 --- a/module/VuFind/src/VuFind/Net/UserIpReaderFactory.php +++ b/module/VuFind/src/VuFind/Net/UserIpReaderFactory.php @@ -34,8 +34,6 @@ use Psr\Container\ContainerExceptionInterface as ContainerException; use Psr\Container\ContainerInterface; -use function is_object; - /** * Factory for instantiating UserIpReader. * @@ -71,14 +69,13 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $allowForwardedIps = $config->Proxy->allow_forwarded_ips ?? false; - $ipFilter = $config->Proxy->forwarded_ip_filter ?? []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $allowForwardedIps = $config['Proxy']['allow_forwarded_ips'] ?? false; + $ipFilter = $config['Proxy']['forwarded_ip_filter'] ?? []; return new $requestedName( $container->get('Request')->getServer(), $allowForwardedIps, - is_object($ipFilter) ? $ipFilter->toArray() : (array)$ipFilter + (array)$ipFilter ); } } diff --git a/module/VuFind/src/VuFind/QRCode/LoaderFactory.php b/module/VuFind/src/VuFind/QRCode/LoaderFactory.php index b394e53c238..42d0ca0f240 100644 --- a/module/VuFind/src/VuFind/QRCode/LoaderFactory.php +++ b/module/VuFind/src/VuFind/QRCode/LoaderFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFindTheme\ThemeInfo::class) ); } diff --git a/module/VuFind/src/VuFind/Recommend/AuthorInfoFactory.php b/module/VuFind/src/VuFind/Recommend/AuthorInfoFactory.php index dbe3887f083..4e50fe3f4f4 100644 --- a/module/VuFind/src/VuFind/Recommend/AuthorInfoFactory.php +++ b/module/VuFind/src/VuFind/Recommend/AuthorInfoFactory.php @@ -33,7 +33,6 @@ use Laminas\ServiceManager\Exception\ServiceNotFoundException; use Psr\Container\ContainerExceptionInterface as ContainerException; use Psr\Container\ContainerInterface; -use VuFind\Config\PluginManager as ConfigManager; /** * AuthorInfo recommendation module factory. @@ -70,11 +69,11 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(ConfigManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $container->get(\VuFind\Search\Results\PluginManager::class), $container->get(\VuFindHttp\HttpService::class)->createClient(), - $config->Content->authors ?? '' + $config['Content']['authors'] ?? '' ); } } diff --git a/module/VuFind/src/VuFind/Recommend/ConsortialVuFindFactory.php b/module/VuFind/src/VuFind/Recommend/ConsortialVuFindFactory.php index 609bc031ad1..5c32f61019f 100644 --- a/module/VuFind/src/VuFind/Recommend/ConsortialVuFindFactory.php +++ b/module/VuFind/src/VuFind/Recommend/ConsortialVuFindFactory.php @@ -71,7 +71,7 @@ public function __invoke( } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('ExternalVuFind'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('ExternalVuFind'), $container->get(\VuFind\Connection\ExternalVuFind::class) ); } diff --git a/module/VuFind/src/VuFind/Recommend/DPLATermsFactory.php b/module/VuFind/src/VuFind/Recommend/DPLATermsFactory.php index 2e01015bf2c..ece5d3fc116 100644 --- a/module/VuFind/src/VuFind/Recommend/DPLATermsFactory.php +++ b/module/VuFind/src/VuFind/Recommend/DPLATermsFactory.php @@ -69,13 +69,12 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - if (!isset($config->DPLA->apiKey)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + if (!isset($config['DPLA']['apiKey'])) { throw new \Exception('DPLA API key missing from configuration.'); } return new $requestedName( - $config->DPLA->apiKey, + $config['DPLA']['apiKey'], $container->get(\VuFindHttp\HttpService::class)->createClient() ); } diff --git a/module/VuFind/src/VuFind/Recommend/EuropeanaResultsFactory.php b/module/VuFind/src/VuFind/Recommend/EuropeanaResultsFactory.php index a6efff0a8b1..8faa62bdf39 100644 --- a/module/VuFind/src/VuFind/Recommend/EuropeanaResultsFactory.php +++ b/module/VuFind/src/VuFind/Recommend/EuropeanaResultsFactory.php @@ -69,11 +69,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - if (!isset($config->Content->europeanaAPI)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + if (!isset($config['Content']['europeanaAPI'])) { throw new \Exception('Europeana API key missing from configuration.'); } - return new $requestedName($config->Content->europeanaAPI); + return new $requestedName($config['Content']['europeanaAPI']); } } diff --git a/module/VuFind/src/VuFind/Recommend/LibGuidesProfileFactory.php b/module/VuFind/src/VuFind/Recommend/LibGuidesProfileFactory.php index c612423ec0d..98a1c34e23e 100644 --- a/module/VuFind/src/VuFind/Recommend/LibGuidesProfileFactory.php +++ b/module/VuFind/src/VuFind/Recommend/LibGuidesProfileFactory.php @@ -71,8 +71,7 @@ public function __invoke( } return new $requestedName( $container->get(\VuFind\Connection\LibGuides::class), - $container->get(\VuFind\Config\PluginManager::class) - ->get('LibGuidesAPI'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('LibGuidesAPI'), $container->get(\VuFind\Cache\Manager::class) ->getCache('object'), ); diff --git a/module/VuFind/src/VuFind/Record/CacheFactory.php b/module/VuFind/src/VuFind/Record/CacheFactory.php index 034e48e63ca..e69136bed7a 100644 --- a/module/VuFind/src/VuFind/Record/CacheFactory.php +++ b/module/VuFind/src/VuFind/Record/CacheFactory.php @@ -71,7 +71,7 @@ public function __invoke( } return new $requestedName( $container->get(\VuFind\RecordDriver\PluginManager::class), - $container->get(\VuFind\Config\PluginManager::class)->get('RecordCache'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('RecordCache'), $container->get(\VuFind\Db\Service\PluginManager::class)->get(RecordServiceInterface::class) ); } diff --git a/module/VuFind/src/VuFind/Record/FallbackLoader/SolrFactory.php b/module/VuFind/src/VuFind/Record/FallbackLoader/SolrFactory.php index a3c6c637832..53a97c37dea 100644 --- a/module/VuFind/src/VuFind/Record/FallbackLoader/SolrFactory.php +++ b/module/VuFind/src/VuFind/Record/FallbackLoader/SolrFactory.php @@ -64,9 +64,8 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('searches'); - $legacyIdField = $config->General->fallback_id_field ?? null; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('searches'); + $legacyIdField = $config['General']['fallback_id_field'] ?? null; $finalOptions = $options ?? []; array_unshift($finalOptions, $legacyIdField); return parent::__invoke($container, $requestedName, $finalOptions); diff --git a/module/VuFind/src/VuFind/RecordDataFormatter/Specs/DefaultRecordFactory.php b/module/VuFind/src/VuFind/RecordDataFormatter/Specs/DefaultRecordFactory.php index 2f386720e6f..36cb8425a16 100644 --- a/module/VuFind/src/VuFind/RecordDataFormatter/Specs/DefaultRecordFactory.php +++ b/module/VuFind/src/VuFind/RecordDataFormatter/Specs/DefaultRecordFactory.php @@ -76,12 +76,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container - ->get(\VuFind\Config\PluginManager::class) - ->get('RecordDataFormatter/DefaultRecord') - ->toArray(); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $config = $configManager->getConfigArray('RecordDataFormatter/DefaultRecord'); // check deprecated legacy RecordDataFormatter.ini for backward compatibility - $oldConfig = $container->get(\VuFind\Config\PluginManager::class)->get('RecordDataFormatter.ini')->toArray(); + $oldConfig = $configManager->getConfigArray('RecordDataFormatter.ini'); if (!empty($oldConfig)) { $logger = $container->get(\VuFind\Log\Logger::class); $warningMessage = 'Using deprecated configuration file RecordDataFormatter.ini! ' diff --git a/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php b/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php index 2985cdf0c1b..2aac5176c1a 100644 --- a/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php @@ -65,8 +65,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $mainConfig = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $mainConfig = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($mainConfig, ...($options ?: [])); } } diff --git a/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php b/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php index 65216b857e8..d7a8d04af15 100644 --- a/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php @@ -92,9 +92,7 @@ protected function getIlsBackends(ContainerInterface $container) // Get a list of ILS-compatible backends. static $ilsBackends = null; if (!is_array($ilsBackends)) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $settings = isset($config->Catalog) ? $config->Catalog->toArray() : []; + $settings = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Catalog'] ?? []; // If the setting is missing, default to the default backend; if it // is present but empty, don't put an empty string in the final array! diff --git a/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php b/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php index 5bc1c51995c..c2a471fc1b0 100644 --- a/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php @@ -69,8 +69,7 @@ public function __invoke( } $parts = explode('\\', $requestedName); $configName = array_pop($parts); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get($configName); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject($configName); $finalOptions = [$config, $config]; return parent::__invoke($container, $requestedName, $finalOptions); } diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php b/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php index fb9c641c59c..16eea95e679 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php @@ -74,8 +74,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get($this->searchIni); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject($this->searchIni); $finalOptions = [null, $config]; return parent::__invoke($container, $requestedName, $finalOptions); } diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrOverdriveFactory.php b/module/VuFind/src/VuFind/RecordDriver/SolrOverdriveFactory.php index e065ed5e381..d529f1154fe 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrOverdriveFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrOverdriveFactory.php @@ -70,9 +70,9 @@ public function __invoke( if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $configManager = $container->get(\VuFind\Config\PluginManager::class); - $config = $configManager->get('config'); - $odConfig = $configManager->get('Overdrive'); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $config = $configManager->getConfigObject('config'); + $odConfig = $configManager->getConfigObject('Overdrive'); $connector = $container->get(OverdriveConnector::class); return new $requestedName($config, $odConfig, $connector); } diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php b/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php index e16077080ce..69d69cd4a5d 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php @@ -67,8 +67,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('website'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('website'); $finalOptions = [$config, $config]; return parent::__invoke($container, $requestedName, $finalOptions); } diff --git a/module/VuFind/src/VuFind/RecordTab/AbstractContentFactory.php b/module/VuFind/src/VuFind/RecordTab/AbstractContentFactory.php index d3ba82397cc..0b80d19f982 100644 --- a/module/VuFind/src/VuFind/RecordTab/AbstractContentFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/AbstractContentFactory.php @@ -33,7 +33,6 @@ use Laminas\ServiceManager\Exception\ServiceNotFoundException; use Psr\Container\ContainerExceptionInterface as ContainerException; use Psr\Container\ContainerInterface; -use VuFind\Config\PluginManager as ConfigManager; use VuFind\Content\PluginManager as ContentManager; use function in_array; @@ -80,7 +79,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(ConfigManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); // Only instantiate the loader if the feature is enabled: $loader = isset($config->Content->{$this->tabName}) ? $container->get(ContentManager::class)->get($this->tabName) diff --git a/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php b/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php index 025a4e4d904..6c8a7a9cf54 100644 --- a/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php @@ -70,7 +70,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('channels')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('channels'); return new $requestedName($container->get(ChannelLoader::class), $config['RecordTab'] ?? []); } } diff --git a/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTreeFactory.php b/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTreeFactory.php index b1300a79ba2..2f9ff45a69b 100644 --- a/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTreeFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTreeFactory.php @@ -70,7 +70,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFind\Record\Loader::class) ); } diff --git a/module/VuFind/src/VuFind/RecordTab/HierarchyTreeFactory.php b/module/VuFind/src/VuFind/RecordTab/HierarchyTreeFactory.php index 456d6e404a5..c7f3705f3ec 100644 --- a/module/VuFind/src/VuFind/RecordTab/HierarchyTreeFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/HierarchyTreeFactory.php @@ -70,7 +70,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config') + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config') ); } } diff --git a/module/VuFind/src/VuFind/RecordTab/HoldingsILSFactory.php b/module/VuFind/src/VuFind/RecordTab/HoldingsILSFactory.php index 7b5071987c0..8ca1775c145 100644 --- a/module/VuFind/src/VuFind/RecordTab/HoldingsILSFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/HoldingsILSFactory.php @@ -72,13 +72,12 @@ public function __invoke( // If VuFind is configured to suppress the holdings tab when the // ILS driver specifies no holdings, we need to pass in a connection // object: - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $catalog = $container->get(\VuFind\ILS\Connection::class); return new $requestedName( $catalog, - (string)($config->Site->holdingsTemplate ?? 'standard'), - (string)($config->Site->hideHoldingsTabWhenEmpty ?? false) + (string)($config['Site']['holdingsTemplate'] ?? 'standard'), + (string)($config['Site']['hideHoldingsTabWhenEmpty'] ?? false) ); } } diff --git a/module/VuFind/src/VuFind/RecordTab/HoldingsWorldCat2Factory.php b/module/VuFind/src/VuFind/RecordTab/HoldingsWorldCat2Factory.php index 48c0bfa6fe1..e0e5cb4c7ac 100644 --- a/module/VuFind/src/VuFind/RecordTab/HoldingsWorldCat2Factory.php +++ b/module/VuFind/src/VuFind/RecordTab/HoldingsWorldCat2Factory.php @@ -69,10 +69,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('WorldCat2'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('WorldCat2'); return new $requestedName( $container->get(\VuFindSearch\Service::class), - $config?->Holdings?->toArray() ?? [] + $config['Holdings'] ?? [] ); } } diff --git a/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php b/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php index 3963a0e9aa9..a3ef004dd4e 100644 --- a/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php @@ -72,18 +72,18 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $cfg = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $cfg = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); // currently only active if config [content] [previews] contains google // and googleoptions[tab] is not empty. $active = false; - if (isset($cfg->Content->previews)) { + if (isset($cfg['Content']['previews'])) { $previews = array_map( 'trim', - explode(',', strtolower($cfg->Content->previews)) + explode(',', strtolower($cfg['Content']['previews'])) ); if ( in_array('google', $previews) - && strlen(trim($cfg->Content->GoogleOptions['tab'] ?? '')) > 0 + && strlen(trim($cfg['Content']['GoogleOptions']['tab'] ?? '')) > 0 ) { $active = true; } diff --git a/module/VuFind/src/VuFind/RecordTab/SimilarItemsCarouselFactory.php b/module/VuFind/src/VuFind/RecordTab/SimilarItemsCarouselFactory.php index 1352234fdf9..0656510d2a5 100644 --- a/module/VuFind/src/VuFind/RecordTab/SimilarItemsCarouselFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/SimilarItemsCarouselFactory.php @@ -71,8 +71,7 @@ public function __invoke( } return new $requestedName( $container->get(\VuFindSearch\Service::class), - $container->get(\VuFind\Config\PluginManager::class) - ->get('config') + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config') ); } } diff --git a/module/VuFind/src/VuFind/RecordTab/UserCommentsFactory.php b/module/VuFind/src/VuFind/RecordTab/UserCommentsFactory.php index 613db041914..87d07e369b8 100644 --- a/module/VuFind/src/VuFind/RecordTab/UserCommentsFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/UserCommentsFactory.php @@ -70,9 +70,8 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } $capabilities = $container->get(\VuFind\Config\AccountCapabilities::class); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $captchaConfig = $config->Captcha->forms ?? ''; + $captchaConfig = $container->get(\VuFind\Config\ConfigManager::class) + ->getConfigArray('config')['Captcha']['forms'] ?? ''; $useCaptcha = trim($captchaConfig) === '*' || str_contains($captchaConfig, 'userComments'); return new $requestedName( diff --git a/module/VuFind/src/VuFind/RecordTab/VersionsFactory.php b/module/VuFind/src/VuFind/RecordTab/VersionsFactory.php index 39bde95f00f..fd484423084 100644 --- a/module/VuFind/src/VuFind/RecordTab/VersionsFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/VersionsFactory.php @@ -73,7 +73,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'), $container->get(\VuFind\Search\Options\PluginManager::class) ); } diff --git a/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php b/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php index cd3a94fb306..a642f7e7f79 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php @@ -34,6 +34,7 @@ use Laminas\ServiceManager\Factory\FactoryInterface; use Psr\Container\ContainerExceptionInterface as ContainerException; use Psr\Container\ContainerInterface; +use VuFind\Exception\BadConfig; /** * Generic factory suitable for most resolver drivers. @@ -65,10 +66,12 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + if (!isset($config['OpenURL']['url'])) { + throw new BadConfig('OpenURL url is not set.'); + } return new $requestedName( - $config->OpenURL->url, + $config['OpenURL']['url'], ...($options ?: []) ); } diff --git a/module/VuFind/src/VuFind/Resolver/Driver/AlmaFactory.php b/module/VuFind/src/VuFind/Resolver/Driver/AlmaFactory.php index 2472ec7261b..18fbea85214 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/AlmaFactory.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/AlmaFactory.php @@ -67,8 +67,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $configs = [$container->get(\VuFind\Config\PluginManager::class) - ->get('config')->OpenURL->toArray()]; + $configs = [$container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['OpenURL']]; if ($options) { array_unshift($options, $configs); } else { diff --git a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php index 683875228ce..6eca022a4c4 100644 --- a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php +++ b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php @@ -83,7 +83,7 @@ protected function getPermissionConfiguration( // Load the permissions: $configLoader = $container->get(\VuFind\Config\PluginManager::class); - $permissions = $configLoader->get('permissions')->toArray(); + $permissions = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('permissions'); // If we're configured to map legacy settings, do so now: if ( diff --git a/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php b/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php index 88b8fa40657..00dfe2c028a 100644 --- a/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php +++ b/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $cfg = $container->get(\VuFind\Config\PluginManager::class) - ->get('permissionBehavior'); + $cfg = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('permissionBehavior'); return new $requestedName($cfg); } } diff --git a/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php b/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php index 734196cf36d..aceb74e3370 100644 --- a/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php +++ b/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $permissions = $container->get(\VuFind\Config\PluginManager::class) - ->get('permissions')->toArray(); + $permissions = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('permissions'); $permManager = new $requestedName($permissions); $permManager->setAuthorizationService( $container->get(\LmcRbacMvc\Service\AuthorizationService::class) diff --git a/module/VuFind/src/VuFind/Role/PermissionProvider/ShibbolethFactory.php b/module/VuFind/src/VuFind/Role/PermissionProvider/ShibbolethFactory.php index f7455c33cd7..f6ff282c3fb 100644 --- a/module/VuFind/src/VuFind/Role/PermissionProvider/ShibbolethFactory.php +++ b/module/VuFind/src/VuFind/Role/PermissionProvider/ShibbolethFactory.php @@ -69,7 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $cfg = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $cfg = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($container->get('Request'), $cfg); } } diff --git a/module/VuFind/src/VuFind/SMS/Factory.php b/module/VuFind/src/VuFind/SMS/Factory.php index e7c48627174..ff908731558 100644 --- a/module/VuFind/src/VuFind/SMS/Factory.php +++ b/module/VuFind/src/VuFind/SMS/Factory.php @@ -62,9 +62,9 @@ public function __invoke( ?array $options = null ) { // Load configurations: - $configManager = $container->get(\VuFind\Config\PluginManager::class); - $mainConfig = $configManager->get('config'); - $smsConfig = $configManager->get('sms'); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $mainConfig = $configManager->getConfigArray('config'); + $smsConfig = $configManager->getConfigObject('sms'); // Determine SMS type: $type = $smsConfig->General->smsType ?? 'Mailer'; @@ -79,8 +79,8 @@ public function __invoke( $options = [ 'mailer' => $container->get(\VuFind\Mailer\Mailer::class), ]; - if (isset($mainConfig->Site->email)) { - $options['defaultFrom'] = $mainConfig->Site->email; + if (isset($mainConfig['Site']['email'])) { + $options['defaultFrom'] = $mainConfig['Site']['email']; } return new Mailer($smsConfig, $options); default: diff --git a/module/VuFind/src/VuFind/Search/Blender/ParamsFactory.php b/module/VuFind/src/VuFind/Search/Blender/ParamsFactory.php index d601e87186b..aad0efdc0ff 100644 --- a/module/VuFind/src/VuFind/Search/Blender/ParamsFactory.php +++ b/module/VuFind/src/VuFind/Search/Blender/ParamsFactory.php @@ -67,8 +67,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $configLoader = $container->get(\VuFind\Config\PluginManager::class); - $blenderConfig = $configLoader->get('Blender'); + $blenderConfig = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('Blender'); $backendConfig = $blenderConfig->Backends ? $blenderConfig->Backends->toArray() : []; if (!$backendConfig) { diff --git a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php index d5e0df5ea7f..7649389765e 100644 --- a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php @@ -77,8 +77,7 @@ class BrowZineBackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $configReader = $this->getService(\VuFind\Config\PluginManager::class); - $this->browzineConfig = $configReader->get('BrowZine'); + $this->browzineConfig = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigObject('BrowZine'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php index b184a9b11f9..454b45c6be8 100644 --- a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php @@ -76,7 +76,7 @@ class EITBackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $this->config = $this->getService(\VuFind\Config\PluginManager::class)->get('EIT'); + $this->config = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigObject('EIT'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php index fbedcc05dcb..ca6fbb5da2e 100644 --- a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php @@ -101,8 +101,8 @@ protected function getServiceName() public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $this->edsConfig = $this->getService(\VuFind\Config\PluginManager::class) - ->get($this->getServiceName()); + $this->edsConfig = $this->getService(\VuFind\Config\ConfigManager::class) + ->getConfigObject($this->getServiceName()); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php index f97a4b3ea79..f5c2397d8d0 100644 --- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php @@ -84,8 +84,8 @@ protected function getServiceName() public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $configReader = $this->getService(\VuFind\Config\PluginManager::class); - $this->libGuidesConfig = $configReader->get($this->getServiceName()); + $this->libGuidesConfig = $this->getService(\VuFind\Config\ConfigManager::class) + ->getConfigObject($this->getServiceName()); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php index 25c4441b7b2..d5569f2705c 100644 --- a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php @@ -74,7 +74,8 @@ class Pazpar2BackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $this->config = $this->getService(\VuFind\Config\PluginManager::class)->get('Pazpar2'); + $this->config = $this->getService(\VuFind\Config\ConfigManager::class) + ->getConfigObject('Pazpar2'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php index 1779e808964..f39b652f583 100644 --- a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php @@ -132,8 +132,7 @@ class PrimoBackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $configReader = $this->getService(\VuFind\Config\PluginManager::class); - $this->primoConfig = $configReader->get('Primo'); + $this->primoConfig = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigObject('Primo'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/ProQuestFSGBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/ProQuestFSGBackendFactory.php index 7860d33c423..ff4d16ad312 100644 --- a/module/VuFind/src/VuFind/Search/Factory/ProQuestFSGBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/ProQuestFSGBackendFactory.php @@ -82,8 +82,9 @@ class ProQuestFSGBackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $this->config = $this->getService(\VuFind\Config\PluginManager::class)->get('config'); - $this->proQuestFSGConfig = $this->getService(\VuFind\Config\PluginManager::class)->get('ProQuestFSG'); + $configManager = $this->getService(\VuFind\Config\ConfigManager::class); + $this->config = $configManager->getConfigObject('config'); + $this->proQuestFSGConfig = $configManager->getConfigObject('ProQuestFSG'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php index c1bfb0fdf3a..b4e409a132c 100644 --- a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php @@ -83,9 +83,9 @@ class SummonBackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $configReader = $this->getService(\VuFind\Config\PluginManager::class); - $this->config = $configReader->get('config'); - $this->summonConfig = $configReader->get('Summon'); + $configManager = $this->getService(\VuFind\Config\ConfigManager::class); + $this->config = $configManager->getConfigObject('config'); + $this->summonConfig = $configManager->getConfigObject('Summon'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/Factory/WorldCat2BackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/WorldCat2BackendFactory.php index 21d3013cd03..4b4bab8a2de 100644 --- a/module/VuFind/src/VuFind/Search/Factory/WorldCat2BackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/WorldCat2BackendFactory.php @@ -87,9 +87,9 @@ class WorldCat2BackendFactory extends AbstractBackendFactory public function __invoke(ContainerInterface $sm, $name, ?array $options = null) { $this->setup($sm); - $configManager = $this->getService(\VuFind\Config\PluginManager::class); - $this->config = $configManager->get('config'); - $this->wcConfig = $configManager->get('WorldCat2'); + $configManager = $this->getService(\VuFind\Config\ConfigManager::class); + $this->config = $configManager->getConfigObject('config'); + $this->wcConfig = $configManager->getConfigObject('WorldCat2'); if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) { $this->logger = $this->getService(\VuFind\Log\Logger::class); } diff --git a/module/VuFind/src/VuFind/Search/HistoryFactory.php b/module/VuFind/src/VuFind/Search/HistoryFactory.php index e4dcefb0b0c..877b7964926 100644 --- a/module/VuFind/src/VuFind/Search/HistoryFactory.php +++ b/module/VuFind/src/VuFind/Search/HistoryFactory.php @@ -74,7 +74,7 @@ public function __invoke( ->get(\VuFind\Search\Results\PluginManager::class); $sessionId = $container->get(\Laminas\Session\SessionManager::class) ->getId(); - $cfg = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $cfg = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($searchService, $sessionId, $resultsManager, $cfg); } } diff --git a/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php index 68b90355f8f..bc286ffd04c 100644 --- a/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php @@ -65,8 +65,7 @@ public function __invoke( ?array $options = null ) { $solr = parent::__invoke($container, $requestedName, $options); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('Search2'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('Search2'); $solr->setSpellingProcessor( new \VuFind\Search\Solr\SpellingProcessor( $config->Spelling ?? null, diff --git a/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php b/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php index 7a1620d3223..116840a1bb5 100644 --- a/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php +++ b/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php @@ -68,23 +68,14 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $tabConfig = isset($config->SearchTabs) - ? $config->SearchTabs->toArray() : []; - $filterConfig = isset($config->SearchTabsFilters) - ? $config->SearchTabsFilters->toArray() : []; - $permissionConfig = isset($config->SearchTabsPermissions) - ? $config->SearchTabsPermissions->toArray() : []; - $settings = isset($config->SearchTabsSettings) - ? $config->SearchTabsSettings->toArray() : []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $container->get(\VuFind\Search\Results\PluginManager::class), - $tabConfig, - $filterConfig, + $config['SearchTabs'] ?? [], + $config['SearchTabsFilters'] ?? [], $container->get('Application')->getRequest(), - $permissionConfig, - $settings + $config['SearchTabsPermissions'] ?? [], + $config['SearchTabsSettings'] ?? [] ); } } diff --git a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php index 67707b17dca..6c042729839 100644 --- a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php @@ -213,8 +213,8 @@ public function onSearchPost(EventInterface $event) */ protected function fetchLocalRecords($event) { - $config = $this->getService(\VuFind\Config\PluginManager::class); - $dataSourceConfig = $config->get($this->dataSourceConfig); + $dataSourceConfig = $this->getService(\VuFind\Config\ConfigManager::class) + ->getConfigArray($this->dataSourceConfig); $recordSources = $this->getActiveRecordSources($event); $sourcePriority = $this->determineSourcePriority($recordSources); $command = $event->getParam('command'); @@ -339,8 +339,7 @@ function ($a, $b) { */ protected function getActiveRecordSources($event): array { - $config = $this->getService(\VuFind\Config\PluginManager::class); - $searchConfig = $config->get($this->searchConfig); + $searchConfig = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigObject($this->searchConfig); return !empty($searchConfig->Records->sources) ? explode(',', $searchConfig->Records->sources) : []; diff --git a/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php b/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php index 104a00c3aef..0e587446af3 100644 --- a/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php @@ -122,8 +122,7 @@ public function __construct( $this->backend = $backend; $this->serviceLocator = $serviceLocator; - $config = $this->getService(\VuFind\Config\PluginManager::class); - $this->facetConfig = $config->get($facetConfig); + $this->facetConfig = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigObject($facetConfig); $this->facetHelper = $this->getService(\VuFind\Search\Solr\HierarchicalFacetHelper::class); $specialFacets = $this->facetConfig->SpecialFacets; diff --git a/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php index e5d4812707a..4377f8ae501 100644 --- a/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php @@ -65,8 +65,7 @@ public function __invoke( ?array $options = null ) { $solr = parent::__invoke($container, $requestedName, $options); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $solr->setSpellingProcessor( new \VuFind\Search\Solr\SpellingProcessor( $config->Spelling ?? null, diff --git a/module/VuFind/src/VuFind/Security/CspHeaderGeneratorFactory.php b/module/VuFind/src/VuFind/Security/CspHeaderGeneratorFactory.php index 3c381fb443a..7e37ae67190 100644 --- a/module/VuFind/src/VuFind/Security/CspHeaderGeneratorFactory.php +++ b/module/VuFind/src/VuFind/Security/CspHeaderGeneratorFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('contentsecuritypolicy'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('contentsecuritypolicy'); $nonceGenerator = $container->get(NonceGenerator::class); return new $requestedName($config, $nonceGenerator); diff --git a/module/VuFind/src/VuFind/Service/CurrencyFormatterFactory.php b/module/VuFind/src/VuFind/Service/CurrencyFormatterFactory.php index a4e99e7098f..b67fdfdfc95 100644 --- a/module/VuFind/src/VuFind/Service/CurrencyFormatterFactory.php +++ b/module/VuFind/src/VuFind/Service/CurrencyFormatterFactory.php @@ -68,11 +68,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( - $config->Site->defaultCurrency ?? null, - $config->Site->locale ?? null + $config['Site']['defaultCurrency'] ?? null, + $config['Site']['locale'] ?? null ); } } diff --git a/module/VuFind/src/VuFind/Service/DateConverterFactory.php b/module/VuFind/src/VuFind/Service/DateConverterFactory.php index f75bd403079..2c91208f6ad 100644 --- a/module/VuFind/src/VuFind/Service/DateConverterFactory.php +++ b/module/VuFind/src/VuFind/Service/DateConverterFactory.php @@ -70,9 +70,7 @@ public function __invoke( } // Pass along key [Site] settings: displayDateFormat, displayTimeFormat, // timezone - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $settings = isset($config->Site) ? $config->Site->toArray() : []; + $settings = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Site'] ?? []; return new $requestedName($settings); } } diff --git a/module/VuFind/src/VuFind/Service/HttpServiceFactory.php b/module/VuFind/src/VuFind/Service/HttpServiceFactory.php index b125b4eff4d..2f99f692a55 100644 --- a/module/VuFind/src/VuFind/Service/HttpServiceFactory.php +++ b/module/VuFind/src/VuFind/Service/HttpServiceFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $options = []; if (isset($config->Proxy->host)) { $options['proxy_host'] = $config->Proxy->host; diff --git a/module/VuFind/src/VuFind/Service/MarkdownFactory.php b/module/VuFind/src/VuFind/Service/MarkdownFactory.php index fc2a6fd657a..f0b5d8ef249 100644 --- a/module/VuFind/src/VuFind/Service/MarkdownFactory.php +++ b/module/VuFind/src/VuFind/Service/MarkdownFactory.php @@ -122,8 +122,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $this->config = $container->get(\VuFind\Config\PluginManager::class) - ->get('markdown')->toArray(); + $this->config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('markdown'); $this->extensions = isset($this->config['Markdown']['extensions']) ? array_map( 'trim', diff --git a/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php b/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php index 3cf3e719601..9418bdce67d 100644 --- a/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php +++ b/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php @@ -73,9 +73,6 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $legacySettingsMap = [ 'publicKey' => 'recaptcha_siteKey', 'siteKey' => 'recaptcha_siteKey', @@ -84,7 +81,7 @@ public function __invoke( 'theme' => 'recaptcha_theme', ]; - $recaptchaConfig = $config->Captcha->toArray(); + $recaptchaConfig = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Captcha']; foreach ($legacySettingsMap as $old => $new) { if (isset($recaptchaConfig[$old])) { error_log( diff --git a/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php b/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php index a3387bb30c1..20e5949ada2 100644 --- a/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php +++ b/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php @@ -65,8 +65,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($config, ...($options ?: [])); } } diff --git a/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php b/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php index 90c7981a264..499a7c308d4 100644 --- a/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php +++ b/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php @@ -56,8 +56,7 @@ protected function isCacheEnabled(ContainerInterface $sm) static $enabled = null; if (null === $enabled) { // Return true if Record Cache is enabled for any data source - $cacheConfig = $sm->get(\VuFind\Config\PluginManager::class) - ->get('RecordCache'); + $cacheConfig = $sm->get(\VuFind\Config\ConfigManager::class)->getConfigArray('RecordCache'); $enabled = false; foreach ($cacheConfig as $section) { foreach ($section as $setting) { diff --git a/module/VuFind/src/VuFind/Session/AbstractBaseFactory.php b/module/VuFind/src/VuFind/Session/AbstractBaseFactory.php index 926dfe2f289..bd0eb25779b 100644 --- a/module/VuFind/src/VuFind/Session/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/Session/AbstractBaseFactory.php @@ -71,8 +71,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $service = new $requestedName($config->Session ?? null); $service->setDbServiceManager( $container->get(\VuFind\Db\Service\PluginManager::class) diff --git a/module/VuFind/src/VuFind/Session/ManagerFactory.php b/module/VuFind/src/VuFind/Session/ManagerFactory.php index 49265437531..2a4fa56a076 100644 --- a/module/VuFind/src/VuFind/Session/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Session/ManagerFactory.php @@ -91,14 +91,13 @@ protected function getOptions(ContainerInterface $container) protected function getHandler(ContainerInterface $container) { // Load and validate session configuration: - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - if (!isset($config->Session->type)) { + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + if (!isset($config['Session']['type'])) { throw new \Exception('Cannot initialize session; configuration missing'); } return $container->get(\VuFind\Session\PluginManager::class) - ->get($config->Session->type); + ->get($config['Session']['type']); } /** diff --git a/module/VuFind/src/VuFind/Session/RedisFactory.php b/module/VuFind/src/VuFind/Session/RedisFactory.php index a8daedfac18..f55590045e9 100644 --- a/module/VuFind/src/VuFind/Session/RedisFactory.php +++ b/module/VuFind/src/VuFind/Session/RedisFactory.php @@ -71,8 +71,7 @@ public function __invoke( throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config')->Session ?? null; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config')->Session ?? null; $service = new $requestedName($this->getConnection($config), $config); $service->setDbServiceManager( $container->get(\VuFind\Db\Service\PluginManager::class) diff --git a/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php b/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php index ab421b7df0f..8f9ac5d9330 100644 --- a/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php +++ b/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php @@ -73,8 +73,8 @@ public function __invoke( * @var HandlerInterface $handler */ $handler = call_user_func($callback); - $config = $container->get(\VuFind\Config\PluginManager::class); - $secure = $config->get('config')->Session->secure ?? false; + $secure = $container->get(\VuFind\Config\ConfigManager::class) + ->getConfigArray('config')['Session']['secure'] ?? false; return $secure ? $this->delegate($container, $handler) : $handler; } diff --git a/module/VuFind/src/VuFind/Sitemap/GeneratorFactory.php b/module/VuFind/src/VuFind/Sitemap/GeneratorFactory.php index a58e82881c8..7045d239a43 100644 --- a/module/VuFind/src/VuFind/Sitemap/GeneratorFactory.php +++ b/module/VuFind/src/VuFind/Sitemap/GeneratorFactory.php @@ -68,14 +68,14 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $configLoader = $container->get(\VuFind\Config\PluginManager::class); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); $enabledLocales = array_keys( $container->get(\VuFind\I18n\Locale\LocaleSettings::class) ->getEnabledLocales() ); return new $requestedName( - $configLoader->get('config')->Site->url ?? '', - $configLoader->get('sitemap'), + $configManager->getConfigArray('config')['Site']['url'] ?? '', + $configManager->getConfigObject('sitemap'), $enabledLocales, $container->get(\VuFind\Sitemap\PluginManager::class) ); diff --git a/module/VuFind/src/VuFind/Sitemap/Plugin/ContentPagesFactory.php b/module/VuFind/src/VuFind/Sitemap/Plugin/ContentPagesFactory.php index 9a1318204f9..10aed51f10d 100644 --- a/module/VuFind/src/VuFind/Sitemap/Plugin/ContentPagesFactory.php +++ b/module/VuFind/src/VuFind/Sitemap/Plugin/ContentPagesFactory.php @@ -68,11 +68,11 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $configLoader = $container->get(\VuFind\Config\PluginManager::class); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName( $container->get(\VuFindTheme\ThemeInfo::class), $container->get('HttpRouter'), - $configLoader->get('config') + $config ); } } diff --git a/module/VuFind/src/VuFind/Sitemap/Plugin/IndexFactory.php b/module/VuFind/src/VuFind/Sitemap/Plugin/IndexFactory.php index 9b6db4d73d4..085a3bea431 100644 --- a/module/VuFind/src/VuFind/Sitemap/Plugin/IndexFactory.php +++ b/module/VuFind/src/VuFind/Sitemap/Plugin/IndexFactory.php @@ -70,8 +70,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $configLoader = $container->get(\VuFind\Config\PluginManager::class); - $sitemapConfig = $configLoader->get('sitemap'); + $sitemapConfig = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('sitemap'); $retrievalMode = $sitemapConfig->Sitemap->retrievalMode ?? 'search'; return new $requestedName( $this->getBackendSettings($sitemapConfig), diff --git a/module/VuFind/src/VuFind/Tags/TagsServiceFactory.php b/module/VuFind/src/VuFind/Tags/TagsServiceFactory.php index 95fdbe84e47..df56e7d91a8 100644 --- a/module/VuFind/src/VuFind/Tags/TagsServiceFactory.php +++ b/module/VuFind/src/VuFind/Tags/TagsServiceFactory.php @@ -72,15 +72,15 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $serviceManager = $container->get(\VuFind\Db\Service\PluginManager::class); return new $requestedName( $serviceManager->get(TagServiceInterface::class), $serviceManager->get(ResourceTagsServiceInterface::class), $serviceManager->get(UserListServiceInterface::class), $container->get(ResourcePopulator::class), - $config->Social->max_tag_length ?? 64, - $config->Social->case_sensitive_tags ?? false + $config['Social']['max_tag_length'] ?? 64, + $config['Social']['case_sensitive_tags'] ?? false ); } } diff --git a/module/VuFind/src/VuFind/UrlShortener/DatabaseFactory.php b/module/VuFind/src/VuFind/UrlShortener/DatabaseFactory.php index 3346f8e7e86..a12188576fa 100644 --- a/module/VuFind/src/VuFind/UrlShortener/DatabaseFactory.php +++ b/module/VuFind/src/VuFind/UrlShortener/DatabaseFactory.php @@ -66,13 +66,12 @@ public function __invoke( $baseUrl = $serverUrl($router->assemble([], ['name' => 'home'])); $service = $container->get(\VuFind\Db\Service\PluginManager::class) ->get(ShortlinksServiceInterface::class); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $salt = $config->Security->HMACkey ?? ''; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $salt = $config['Security']['HMACkey'] ?? ''; if (empty($salt)) { throw new Exception('HMACkey missing from configuration.'); } - $hashType = $config->Mail->url_shortener_key_type ?? 'md5'; + $hashType = $config['Mail']['url_shortener_key_type'] ?? 'md5'; return new $requestedName(rtrim($baseUrl, '/'), $service, $salt, $hashType); } } diff --git a/module/VuFind/src/VuFind/UrlShortener/ServiceFactory.php b/module/VuFind/src/VuFind/UrlShortener/ServiceFactory.php index 437be05ead3..db410492cfe 100644 --- a/module/VuFind/src/VuFind/UrlShortener/ServiceFactory.php +++ b/module/VuFind/src/VuFind/UrlShortener/ServiceFactory.php @@ -59,10 +59,8 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $service = empty($config->Mail->url_shortener) - ? 'none' : $config->Mail->url_shortener; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + $service = empty($config['Mail']['url_shortener']) ? 'none' : $config['Mail']['url_shortener']; return $container->get(PluginManager::class)->get($service); } } diff --git a/module/VuFind/src/VuFind/Validator/SessionCsrfFactory.php b/module/VuFind/src/VuFind/Validator/SessionCsrfFactory.php index 36a9c3afcaf..688ec3c22ba 100644 --- a/module/VuFind/src/VuFind/Validator/SessionCsrfFactory.php +++ b/module/VuFind/src/VuFind/Validator/SessionCsrfFactory.php @@ -73,13 +73,12 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $sessionManager = $container->get(\Laminas\Session\SessionManager::class); return new $requestedName( [ 'session' => new \Laminas\Session\Container('csrf', $sessionManager), - 'salt' => $config->Security->HMACkey ?? 'VuFindCsrfSalt', + 'salt' => $config['Security']['HMACkey'] ?? 'VuFindCsrfSalt', ] ); } diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap5/LayoutClassFactory.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap5/LayoutClassFactory.php index ceac22e6024..983455abe3e 100644 --- a/module/VuFind/src/VuFind/View/Helper/Bootstrap5/LayoutClassFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap5/LayoutClassFactory.php @@ -68,11 +68,10 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $sidebarOnLeft = $config->Site->sidebarOnLeft ?? false; - $mirror = $config->Site->mirrorSidebarInRTL ?? true; - $offcanvas = $config->Site->offcanvas ?? false; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config')['Site']; + $sidebarOnLeft = $config['sidebarOnLeft'] ?? false; + $mirror = $config['mirrorSidebarInRTL'] ?? true; + $offcanvas = $config['offcanvas'] ?? false; // The right-to-left setting is injected into the layout by the Bootstrapper; // pull it back out here to avoid duplicate effort, then use it to apply // the mirror setting appropriately. diff --git a/module/VuFind/src/VuFind/View/Helper/Root/AlphaBrowseFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/AlphaBrowseFactory.php index d7d2eb4c118..0d9ecc26493 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/AlphaBrowseFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/AlphaBrowseFactory.php @@ -69,10 +69,8 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } $helpers = $container->get('ViewHelperManager'); - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); - $options = isset($config->AlphaBrowse) - ? $config->AlphaBrowse->toArray() : []; + $options = $container->get(\VuFind\Config\ConfigManager::class) + ->getConfigArray('config')['AlphaBrowse'] ?? []; return new $requestedName($helpers->get('url'), $options); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/CaptchaFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/CaptchaFactory.php index 76d34032dbd..a68b3a87d1c 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/CaptchaFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/CaptchaFactory.php @@ -71,8 +71,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $captchaTypes = $config->Captcha->types ?? []; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/CleanHtmlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/CleanHtmlFactory.php index 9f59a1d0f18..bbb035a62c7 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/CleanHtmlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/CleanHtmlFactory.php @@ -38,7 +38,6 @@ use Laminas\ServiceManager\Factory\FactoryInterface; use Psr\Container\ContainerExceptionInterface as ContainerException; use Psr\Container\ContainerInterface; -use VuFind\Config\PluginManager as ConfigPluginManager; /** * CleanHtml helper factory. @@ -97,7 +96,7 @@ public function __invoke( } // Modify default context settings per configuration - $config = $container->get(ConfigPluginManager::class)->get('config')->toArray(); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $this->allowedElements = ($config['HTML_Rendering_Contexts']['allowed_elements'] ?? []) + $this->allowedElements; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/CookieConsentFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/CookieConsentFactory.php index c3c6984ba35..25aeea508f1 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/CookieConsentFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/CookieConsentFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $consentConfig = $container->get(\VuFind\Config\YamlReader::class) ->get('CookieConsent.yaml'); return new $requestedName( diff --git a/module/VuFind/src/VuFind/View/Helper/Root/EscapeOrCleanHtmlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/EscapeOrCleanHtmlFactory.php index 01c58c788db..188f0779777 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/EscapeOrCleanHtmlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/EscapeOrCleanHtmlFactory.php @@ -71,7 +71,7 @@ public function __invoke( } $helpers = $container->get('ViewHelperManager'); - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName(new Escaper(), $helpers->get('cleanHtml'), $config->toArray()); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php index 04a9a233bcb..3f227636917 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($config->Feedback->tab_enabled ?? false); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php index d4e70deb2e9..f44cd4d57a3 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $key = $config->GoogleAnalytics->apiKey ?? false; $options = [ 'create_options_js' => diff --git a/module/VuFind/src/VuFind/View/Helper/Root/GoogleTagManagerFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/GoogleTagManagerFactory.php index d906a3f47d0..f42228953e2 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/GoogleTagManagerFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/GoogleTagManagerFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $gtmContainerId = $config->GoogleTagManager->gtmContainerId ?? false; return new $requestedName($gtmContainerId); } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php index 5d92e820e1a..bf076109f91 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $labels = isset($config->SearchHistoryLabels) ? $config->SearchHistoryLabels->toArray() : []; $helpers = $container->get('ViewHelperManager'); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/HoldingsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/HoldingsFactory.php index 53893cea885..f7afc65a403 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/HoldingsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/HoldingsFactory.php @@ -66,8 +66,7 @@ public function __invoke( ?array $options = null ) { return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config') - ->toArray() + $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config') ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/IdentifierLinkerFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/IdentifierLinkerFactory.php index 0bc93b13043..80bd2cbdf46 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/IdentifierLinkerFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/IdentifierLinkerFactory.php @@ -68,7 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $helpers = $container->get('ViewHelperManager'); // DOI config section is supported as a fallback for legacy back-compatibility: $idConfig = $config?->IdentifierLinks?->toArray() ?? $config?->DOI?->toArray() ?? []; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php index f975010e47e..083d03baa4c 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($config->Session->keepAlive ?? 0); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/MatomoFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/MatomoFactory.php index dfa949f5661..2bda922c9e7 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/MatomoFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/MatomoFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $request = $container->get('Request'); $router = $container->get('Router'); return new $requestedName($config, $router, $request); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/MetadataFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/MetadataFactory.php index ee04550cd38..779230bf9c9 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/MetadataFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/MetadataFactory.php @@ -65,7 +65,7 @@ public function __invoke( return new Metadata( $container->get(\VuFind\MetadataVocabulary\PluginManager::class), - $container->get(\VuFind\Config\PluginManager::class)->get('metadata'), + $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('metadata'), $container->get('ViewHelperManager')->get('HeadMeta') ); } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php index b822ec888fb..48a677ad125 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $pathResolver = $container->get(\VuFind\Config\PathResolver::class); $openUrlRules = json_decode( file_get_contents( diff --git a/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php index 355878de9e6..d2d573681f1 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php @@ -72,9 +72,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } // Only load the connector if we need to show - $config = $container->get(\VuFind\Config\PluginManager::class)->get( - 'Overdrive' - ); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('Overdrive'); $connector = null; $showMyContent = $config->Overdrive->showMyContent; $showAdmin = $config->Overdrive->showOverdriveAdminMenu; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php index b5c7c5c4aa9..34618af4e38 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $url = $config->Piwik->url ?? false; $settings = [ 'siteId' => $config->Piwik->site_id ?? 1, diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php index dd07ea64bcd..4217543a9a5 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $cache = $container->get(\VuFind\Cache\Manager::class) ->getCache('object'); return new $requestedName($config, $cache); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php index 273b74d332e..bbf947a4dcd 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php @@ -69,7 +69,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $helper = new $requestedName($container->get(TagsService::class), $config); $helper->setCoverRouter($container->get(\VuFind\Cover\Router::class)); $helper->setSearchMemory($container->get(\VuFind\Search\Memory::class)); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php index c1916cdb657..c1ec9d7e828 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $urlHelper = $container->get('ViewHelperManager')->get('url'); $loginUrl = $urlHelper('relais-login'); return new $requestedName($config->Relais ?? null, $loginUrl); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ResultFeedFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ResultFeedFactory.php index c55b17b1bbb..a6e813779ac 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ResultFeedFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ResultFeedFactory.php @@ -68,7 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('searches'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('searches'); $settings = ['prioritizeRecordDriverLinks' => $config->RSS->prioritizeRecordDriverLinks ?? false]; $helper = new $requestedName($settings); $helper->registerExtensions($container); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SchemaOrgFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SchemaOrgFactory.php index 75dca55b85b..b78ea728151 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SchemaOrgFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SchemaOrgFactory.php @@ -72,9 +72,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container - ->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName( $container->get('ViewHelperManager')->get('htmlAttributes'), $config->Record->includeSchemaOrgMetadata ?? true diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php index 0fb3876b8be..5a23db545a3 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php @@ -68,18 +68,17 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class); - $mainConfig = $config->get('config'); - $searchboxConfig = $config->get('searchbox')->toArray(); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); + $mainConfig = $configManager->getConfigArray('config'); + $searchboxConfig = $configManager->getConfigArray('searchbox'); $includeAlphaOptions = $searchboxConfig['General']['includeAlphaBrowse'] ?? false; return new $requestedName( $container->get(\VuFind\Search\Options\PluginManager::class), $searchboxConfig, - isset($mainConfig->SearchPlaceholder) - ? $mainConfig->SearchPlaceholder->toArray() : [], - $includeAlphaOptions && isset($mainConfig->AlphaBrowse_Types) - ? $mainConfig->AlphaBrowse_Types->toArray() : [] + $mainConfig['SearchPlaceholder'] ?? [], + $includeAlphaOptions && isset($mainConfig['AlphaBrowse_Types']) + ? $mainConfig['AlphaBrowse_Types'] : [] ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchSettingsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchSettingsFactory.php index 6e3a5e6ccb6..7bb62b5c1b5 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchSettingsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchSettingsFactory.php @@ -69,7 +69,7 @@ public function __invoke( throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get(\VuFind\Config\PluginManager::class)->get('config')->toArray() + $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config') ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ServerUrlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ServerUrlFactory.php index 19b18472f22..e5544ca2455 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ServerUrlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ServerUrlFactory.php @@ -69,9 +69,9 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $cfg = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $cfg = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); $helper = new $requestedName(); - if ($cfg->Site->reverse_proxy ?? false) { + if ($cfg['Site']['reverse_proxy'] ?? false) { $helper->setUseProxy(true); } return $helper; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php index 68c06b68746..212c5af593c 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php @@ -68,8 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName($config->Syndetics ?? null); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php index 3d6c716f090..0e912aee956 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php @@ -68,7 +68,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); - return new $requestedName($config->Site->email ?? ''); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); + return new $requestedName($config['Site']['email'] ?? ''); } } diff --git a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php index ee1e09d39ef..08f1c4a9d28 100644 --- a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php +++ b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php @@ -95,8 +95,7 @@ public static function getChangeTracker() */ public static function getConfig($config = 'config') { - return static::$serviceLocator->get(\VuFind\Config\PluginManager::class) - ->get($config); + return static::$serviceLocator->get(\VuFind\Config\ConfigManager::class)->getConfigObject($config); } /** diff --git a/module/VuFind/src/VuFindTest/Feature/ConfigRelatedServicesTrait.php b/module/VuFind/src/VuFindTest/Feature/ConfigRelatedServicesTrait.php index 959772d45c8..4150614bd8f 100644 --- a/module/VuFind/src/VuFindTest/Feature/ConfigRelatedServicesTrait.php +++ b/module/VuFind/src/VuFindTest/Feature/ConfigRelatedServicesTrait.php @@ -158,6 +158,67 @@ protected function addConfigRelatedServicesToContainer( $container->set(ConfigPluginManager::class, $configPluginManager); } + /** + * Get a mock configuration plugin manager with the given configuration "files" + * available. + * + * @param array $configs An associative array of configurations + * where key is the file (e.g. 'config') and value an array of configuration + * sections and directives + * @param array $default Default configuration to return when no + * entry is found in $configs + * @param ?InvocationOrder $getConfigArrayExpect The expected invocation order for the getConfigArray() + * method (null for any) + * + * @return MockObject&ConfigManager + */ + protected function getMockConfigManager( + array $configs, + array $default = [], + ?InvocationOrder $getConfigArrayExpect = null + ): ConfigManager { + $manager = $this->createMock(ConfigManager::class); + $manager->expects($getConfigArrayExpect ?? $this->any()) + ->method('getConfigArray') + ->with($this->isType('string')) + ->will( + $this->returnCallback( + function ($config) use ($configs, $default): array { + return $configs[$config] ?? $default; + } + ) + ); + $manager->expects($this->any()) + ->method('getConfigObject') + ->with($this->isType('string')) + ->will( + $this->returnCallback( + function ($config) use ($configs, $default): Config { + return new Config($configs[$config] ?? $default); + } + ) + ); + return $manager; + } + + /** + * Get a mock configuration manager that will throw an exception. + * + * @param \Throwable $exception Exception to throw + * + * @return MockObject&ConfigManager + */ + protected function getMockFailingConfigManager( + \Throwable $exception + ): ConfigManager { + $manager = $this->createMock(ConfigManager::class); + $manager->expects($this->any()) + ->method('getConfig') + ->with($this->isType('string')) + ->will($this->throwException($exception)); + return $manager; + } + /** * Get a mock configuration plugin manager with the given configuration "files" * available. diff --git a/module/VuFind/src/VuFindTest/Feature/SolrSearchObjectTrait.php b/module/VuFind/src/VuFindTest/Feature/SolrSearchObjectTrait.php index 0179a037ef8..5c391d9aef6 100644 --- a/module/VuFind/src/VuFindTest/Feature/SolrSearchObjectTrait.php +++ b/module/VuFind/src/VuFindTest/Feature/SolrSearchObjectTrait.php @@ -49,7 +49,7 @@ trait SolrSearchObjectTrait * * @return \VuFind\Config\PluginManager */ - public function getMockConfigManager(): \VuFind\Config\PluginManager + public function getMockEmptyConfigPluginManager(): \VuFind\Config\PluginManager { $manager = $this->createMock(\VuFind\Config\PluginManager::class); $manager->expects($this->any())->method('get') @@ -65,7 +65,7 @@ public function getMockConfigManager(): \VuFind\Config\PluginManager public function getSolrOptions(): Options { return new Options( - $this->getMockConfigManager() + $this->getMockEmptyConfigPluginManager() ); } @@ -80,7 +80,7 @@ public function getSolrParams(?Options $options = null): Params { return new Params( $options ?? $this->getSolrOptions(), - $this->getMockConfigManager() + $this->getMockEmptyConfigPluginManager() ); } diff --git a/module/VuFind/src/VuFindTest/Feature/ViewTrait.php b/module/VuFind/src/VuFindTest/Feature/ViewTrait.php index ab7e43d169b..85cadb289e6 100644 --- a/module/VuFind/src/VuFindTest/Feature/ViewTrait.php +++ b/module/VuFind/src/VuFindTest/Feature/ViewTrait.php @@ -34,8 +34,7 @@ use Laminas\View\Renderer\PhpRenderer; use Psr\Container\ContainerInterface; use VuFind\Cache\Manager as CacheManager; -use VuFind\Config\Config; -use VuFind\Config\PluginManager as ConfigPluginManager; +use VuFind\Config\ConfigManager; use VuFind\View\Helper\Root\CleanHtml; use VuFind\View\Helper\Root\CleanHtmlFactory; use VuFind\View\Helper\Root\SearchMemory; @@ -161,19 +160,18 @@ public function getCacheDir(): string $cacheManager->expects($this->any()) ->method('getCache') ->willReturn($cache); - $config = $this->createMock(Config::class); - $configPluginManager = $this->createMock(ConfigPluginManager::class); - $configPluginManager->expects($this->any()) - ->method('get') - ->willReturn($config); + $configManager = $this->createMock(ConfigManager::class); + $configManager->expects($this->any()) + ->method('getConfigArray') + ->willReturn([]); $container = $this->createMock(ContainerInterface::class); $container->expects($this->any()) ->method('get') ->willReturnCallback( - function ($class) use ($cacheManager, $configPluginManager) { + function ($class) use ($cacheManager, $configManager) { return match ($class) { CacheManager::class => $cacheManager, - ConfigPluginManager::class => $configPluginManager, + ConfigManager::class => $configManager, }; } ); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/GetResolverLinksTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/GetResolverLinksTest.php index e6f1ffdcbe1..3db059e319b 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/GetResolverLinksTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/GetResolverLinksTest.php @@ -58,8 +58,8 @@ class GetResolverLinksTest extends \VuFindTest\Unit\AjaxHandlerTestCase protected function setupConfig($config = []) { $this->container->set( - \VuFind\Config\PluginManager::class, - $this->getMockConfigPluginManager(compact('config')) + \VuFind\Config\ConfigManager::class, + $this->getMockConfigManager(compact('config')) ); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/IdentifierLinksLookupTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/IdentifierLinksLookupTest.php index 11631f39afe..ef9d9b6a1fb 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/IdentifierLinksLookupTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/AjaxHandler/IdentifierLinksLookupTest.php @@ -60,8 +60,8 @@ class IdentifierLinksLookupTest extends \VuFindTest\Unit\AjaxHandlerTestCase protected function setupConfig($config) { $this->container->set( - \VuFind\Config\PluginManager::class, - $this->getMockConfigPluginManager(compact('config')) + \VuFind\Config\ConfigManager::class, + $this->getMockConfigManager(compact('config')) ); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/IdentifierLinker/BrowZineTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/IdentifierLinker/BrowZineTest.php index 49c13795a63..5bf1fe57c1e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/IdentifierLinker/BrowZineTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/IdentifierLinker/BrowZineTest.php @@ -240,10 +240,12 @@ protected function getBrowZineHandler( if ($bestIntegratorLinksConfig !== null) { $configArray['BestIntegratorLinks'] = $bestIntegratorLinksConfig; } - $configObj = new \VuFind\Config\Config($configArray); - $mockConfigManager = $this->createMock(\VuFind\Config\PluginManager::class); - $mockConfigManager->expects($this->once())->method('get')->with('BrowZine')->willReturn($configObj); - $container->set(\VuFind\Config\PluginManager::class, $mockConfigManager); + $mockConfigManager = $this->createMock(\VuFind\Config\ConfigManager::class); + $mockConfigManager->expects($this->once()) + ->method('getConfigArray') + ->with('BrowZine') + ->willReturn($configArray); + $container->set(\VuFind\Config\ConfigManager::class, $mockConfigManager); $factory = new BrowZineFactory(); return $factory($container, BrowZine::class); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Mailer/MailerTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Mailer/MailerTest.php index 0c5ace99726..2f1c261ca80 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Mailer/MailerTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Mailer/MailerTest.php @@ -73,9 +73,9 @@ public function testFactoryConfiguration() 'dsn' => 'esmtp://foo@bar/', ], ]; - $cm = $this->getMockConfigPluginManager(compact('config')); + $cm = $this->getMockConfigManager(compact('config')); $sm = new MockContainer($this); - $sm->set(\VuFind\Config\PluginManager::class, $cm); + $sm->set(\VuFind\Config\ConfigManager::class, $cm); $factory = new MailerFactory(); $this->assertEquals( diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Net/UserIpReaderFactoryTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Net/UserIpReaderFactoryTest.php index 74d74133661..038e4b5fd58 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Net/UserIpReaderFactoryTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Net/UserIpReaderFactoryTest.php @@ -59,8 +59,8 @@ protected function getContainer($config = [], $server = ['server' => true]): \Vu { $container = new \VuFindTest\Container\MockContainer($this); $container->set( - \VuFind\Config\PluginManager::class, - $this->getMockConfigPluginManager(compact('config'), [], $this->once()) + \VuFind\Config\ConfigManager::class, + $this->getMockConfigManager(compact('config'), [], $this->once()) ); $mockRequest = $this ->getMockBuilder(\Laminas\Http\PhpEnvironment\Request::class) diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Service/MarkdownFactoryTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Service/MarkdownFactoryTest.php index 9d6357331ea..ff7666c90c9 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Service/MarkdownFactoryTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Service/MarkdownFactoryTest.php @@ -375,8 +375,8 @@ protected function getMarkdownConverter(array $config): ConverterInterface new \VuFindTest\Markdown\ExampleExtension() ); $container->set( - \VuFind\Config\PluginManager::class, - $this->getMockConfigPluginManager(['markdown' => $config]) + \VuFind\Config\ConfigManager::class, + $this->getMockConfigManager(['markdown' => $config]) ); $markdownFactory = new MarkdownFactory(); return $markdownFactory( diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Sitemap/Plugin/ContentPagesTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Sitemap/Plugin/ContentPagesTest.php index 554abcdb052..ef828942390 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Sitemap/Plugin/ContentPagesTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Sitemap/Plugin/ContentPagesTest.php @@ -135,8 +135,8 @@ protected function getContentPages( ): ContentPages { // Set up configuration: $this->container->set( - \VuFind\Config\PluginManager::class, - $this->getMockConfigPluginManager(compact('config')) + \VuFind\Config\ConfigManager::class, + $this->getMockConfigManager(compact('config')) ); // Set up other dependencies: diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/XSLT/Import/VuFindTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/XSLT/Import/VuFindTest.php index e62200c6a5c..af206c8e0f0 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/XSLT/Import/VuFindTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/XSLT/Import/VuFindTest.php @@ -81,7 +81,7 @@ public function testGetConfig() { $container = $this->getMockContainer(); $this->addConfigRelatedServicesToContainer($container); - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); VuFind::setServiceLocator($container); $this->assertEquals($config, VuFind::getConfig()); } diff --git a/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php b/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php index f82ba89796e..73fe99600c3 100644 --- a/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php +++ b/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php @@ -118,8 +118,7 @@ public function homeAction() protected function getScripts(): array { // Load the AdminScripts.ini settings - $config = $this->getService(\VuFind\Config\PluginManager::class) - ->get('AdminScripts')->toArray(); + $config = $this->getService(\VuFind\Config\ConfigManager::class)->getConfigArray('AdminScripts'); $globalConfig = $config['Global'] ?? []; unset($config['Global']); diff --git a/module/VuFindConsole/src/VuFindConsole/Command/Generate/ThemeCommandFactory.php b/module/VuFindConsole/src/VuFindConsole/Command/Generate/ThemeCommandFactory.php index 60cd993b9be..7c5f2057162 100644 --- a/module/VuFindConsole/src/VuFindConsole/Command/Generate/ThemeCommandFactory.php +++ b/module/VuFindConsole/src/VuFindConsole/Command/Generate/ThemeCommandFactory.php @@ -64,8 +64,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); return new $requestedName( $container->get(\VuFindTheme\ThemeGenerator::class), $config, diff --git a/module/VuFindConsole/src/VuFindConsole/Command/Import/WebCrawlCommandFactory.php b/module/VuFindConsole/src/VuFindConsole/Command/Import/WebCrawlCommandFactory.php index 5b76c765c80..7b6a6fbdfee 100644 --- a/module/VuFindConsole/src/VuFindConsole/Command/Import/WebCrawlCommandFactory.php +++ b/module/VuFindConsole/src/VuFindConsole/Command/Import/WebCrawlCommandFactory.php @@ -65,11 +65,11 @@ public function __invoke( $requestedName, ?array $options = null ) { - $configLoader = $container->get(\VuFind\Config\PluginManager::class); + $configManager = $container->get(\VuFind\Config\ConfigManager::class); return new $requestedName( new \VuFind\XSLT\Importer($container), $container->get(\VuFind\Solr\Writer::class), - $configLoader->get('webcrawl'), + $configManager->getConfigObject('webcrawl'), ...($options ?? []) ); } diff --git a/module/VuFindConsole/src/VuFindConsole/Command/ScheduledSearch/NotifyCommandFactory.php b/module/VuFindConsole/src/VuFindConsole/Command/ScheduledSearch/NotifyCommandFactory.php index 39339b79d9f..e20d82ea35c 100644 --- a/module/VuFindConsole/src/VuFindConsole/Command/ScheduledSearch/NotifyCommandFactory.php +++ b/module/VuFindConsole/src/VuFindConsole/Command/ScheduledSearch/NotifyCommandFactory.php @@ -70,8 +70,7 @@ public function __invoke( $scheduleOptions = $container ->get(\VuFind\Search\History::class) ->getScheduleOptions(); - $mainConfig = $container->get(\VuFind\Config\PluginManager::class) - ->get('config'); + $mainConfig = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); // We need to initialize the theme so that the view renderer works: $theme = new \VuFindTheme\Initializer($mainConfig->Site, $container); diff --git a/module/VuFindConsole/src/VuFindConsole/Command/Util/SwitchDbHashCommandFactory.php b/module/VuFindConsole/src/VuFindConsole/Command/Util/SwitchDbHashCommandFactory.php index aeca9654ddc..ed5a231684d 100644 --- a/module/VuFindConsole/src/VuFindConsole/Command/Util/SwitchDbHashCommandFactory.php +++ b/module/VuFindConsole/src/VuFindConsole/Command/Util/SwitchDbHashCommandFactory.php @@ -69,7 +69,7 @@ public function __invoke( $requestedName, ?array $options = null ) { - $config = $container->get(\VuFind\Config\PluginManager::class)->get('config'); + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigObject('config'); $serviceManager = $container->get(\VuFind\Db\Service\PluginManager::class); return new $requestedName( $config, diff --git a/module/VuFindTheme/src/VuFindTheme/AssetPipelineFactory.php b/module/VuFindTheme/src/VuFindTheme/AssetPipelineFactory.php index ca53b35e6cb..583d21fb6bb 100644 --- a/module/VuFindTheme/src/VuFindTheme/AssetPipelineFactory.php +++ b/module/VuFindTheme/src/VuFindTheme/AssetPipelineFactory.php @@ -99,8 +99,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $configManager = $container->get(\VuFind\Config\PluginManager::class); - $config = $configManager->get('config')?->toArray() ?? []; + $config = $container->get(\VuFind\Config\ConfigManager::class)->getConfigArray('config'); return new $requestedName( $container->get(\VuFindTheme\ThemeInfo::class), $container->get('ViewHelperManager')->get('url'),