You are here

public function StandardSolrConnector::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

1 method overrides StandardSolrConnector::alterConfigFiles()
StandardSolrCloudConnector::alterConfigFiles in src/Plugin/SolrConnector/StandardSolrCloudConnector.php
Alter the newly assembled Solr configuration files.

File

src/Plugin/SolrConnector/StandardSolrConnector.php, line 44

Class

StandardSolrConnector
Standard Solr connector.

Namespace

Drupal\search_api_solr\Plugin\SolrConnector

Code

public function alterConfigFiles(array &$files, string $lucene_match_version, string $server_id = '') {
  parent::alterConfigFiles($files, $lucene_match_version, $server_id);
  if (!empty($this->configuration['solr_install_dir'])) {
    $files['solrcore.properties'] = preg_replace("/solr\\.install\\.dir.*\$/m", 'solr.install.dir=' . $this->configuration['solr_install_dir'], $files['solrcore.properties']);
  }
  else {
    $files['solrcore.properties'] = preg_replace("/solr\\.install\\.dir.*\$/m", '', $files['solrcore.properties']);
  }
}