You are here

public function Solr36Connector::alterConfigFiles in Search API Solr 4.x

Alter the newly assembled Solr configuration files.

Parameters

string[] $files: Array of config files keyed by file names.

string $lucene_match_version: Lucene (Solr) minor version string.

string $server_id: Optional Search API server id. Will be set in most cases but might be empty when the config generation is triggered via UI or drush.

Overrides SolrConnectorPluginBase::alterConfigFiles

File

modules/search_api_solr_legacy/src/Plugin/SolrConnector/Solr36Connector.php, line 139

Class

Solr36Connector
Class Solr36Connector.

Namespace

Drupal\search_api_solr_legacy\Plugin\SolrConnector

Code

public function alterConfigFiles(array &$files, string $lucene_match_version, string $server_id = '') {
  parent::alterConfigFiles($files, $lucene_match_version, $server_id);
  if (version_compare($lucene_match_version, '4', '<')) {
    if (isset($files['solrconfig.xml'])) {
      $files['solrconfig.xml'] = str_replace('SEARCH_API_SOLR_SOLRCONFIG_INDEX', $files['solrconfig_index.xml'] ?? '', $files['solrconfig.xml']);
      $files['solrconfig.xml'] = str_replace('SEARCH_API_SOLR_SOLRCONFIG_EXTRA', $files['solrconfig_extra.xml'] ?? '', $files['solrconfig.xml']);
      unset($files['solrconfig_index.xml']);
      unset($files['solrconfig_extra.xml']);
    }
    if (isset($files['schema.xml'])) {
      $files['schema.xml'] = str_replace('SEARCH_API_SOLR_SCHEMA_EXTRA_FIELDS', $files['schema_extra_fields.xml'] ?? '', $files['schema.xml']);
      $files['schema.xml'] = str_replace('SEARCH_API_SOLR_SCHEMA_EXTRA_TYPES', $files['schema_extra_types.xml'] ?? '', $files['schema.xml']);
      unset($files['schema_extra_types.xml']);
      unset($files['schema_extra_fields.xml']);
    }
  }
}