You are here

function search_api_solr_update_8004 in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 search_api_solr.install \search_api_solr_update_8004()
  2. 8.2 search_api_solr.install \search_api_solr_update_8004()
  3. 4.x search_api_solr.install \search_api_solr_update_8004()

Migrate existing backend configurations to the basic auth connector plugin.

File

./search_api_solr.install, line 213

Code

function search_api_solr_update_8004() {
  foreach (search_api_solr_update_helper_get_backend_configs() as $server_name => $backend_config) {
    $backend_config['connector'] = 'basic_auth';
    $backend_config['connector_config'] = [];
    foreach ([
      'scheme',
      'host',
      'port',
      'path',
      'core',
      'timeout',
      'index_timeout',
      'optimize_timeout',
      'solr_version',
      'http_method',
      'username',
      'password',
    ] as $key) {
      $backend_config['connector_config'][$key] = $backend_config[$key];
      unset($backend_config[$key]);
    }
    search_api_solr_update_helper_save_backend_config($server_name, $backend_config);
  }
}