*/ class ExtensionConfiguration { /** * Extension Configuration * * @var array */ protected $configuration = []; /** * ExtensionConfiguration constructor. * @param array $configurationToUse */ public function __construct($configurationToUse = []) { if (empty($configurationToUse)) { $this->configuration = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)->get('meilisearch'); } else { $this->configuration = $configurationToUse; } } /** * Get configuration for useConfigurationFromClosestTemplate * * @return bool */ public function getIsUseConfigurationFromClosestTemplateEnabled() { return (bool)$this->getConfigurationOrDefaultValue('useConfigurationFromClosestTemplate', false); } /** * Get configuration for useConfigurationTrackRecordsOutsideSiteroot * * @return bool */ public function getIsUseConfigurationTrackRecordsOutsideSiteroot() { return (bool)$this->getConfigurationOrDefaultValue('useConfigurationTrackRecordsOutsideSiteroot', true); } /** * Get configuration for allowSelfSignedCertificates * * @return bool */ public function getIsSelfSignedCertificatesEnabled() { return (bool)$this->getConfigurationOrDefaultValue('allowSelfSignedCertificates', false); } /** * Get configuration for useConfigurationMonitorTables * * @return array of tableName */ public function getIsUseConfigurationMonitorTables() { $monitorTables = []; $monitorTablesList = $this->getConfigurationOrDefaultValue('useConfigurationMonitorTables', ''); if (empty($monitorTablesList)) { return $monitorTables; } return GeneralUtility::trimExplode(',', $monitorTablesList); } /** * Get configuration for allowLegacySiteMode * * @return bool */ public function getIsAllowLegacySiteModeEnabled(): bool { trigger_error('solr:deprecation: Method getIsAllowLegacySiteModeEnabled is deprecated since EXT:meilisearch 11 and will be removed in 12. Since EXT:meilisearch 10 legacy site handling is deprecated and was removed in EXT:meilisearch 11.', E_USER_DEPRECATED); //@todo throw exception if set to true and log deprecation $legacyModeIsActive = $this->getConfigurationOrDefaultValue('allowLegacySiteMode', false); if($legacyModeIsActive === true) { throw new \InvalidArgumentException("Legacy mode is not supported anymore, please migrate your system to use sitehandling now!"); } return false; } /** * @param string $key * @param mixed $defaultValue * @return mixed */ protected function getConfigurationOrDefaultValue($key, $defaultValue) { return isset($this->configuration[$key]) ? $this->configuration[$key] : $defaultValue; } }