You are here

public function SearchApiAcquiaSearchMultiService::setConnectionOptions in Acquia Search Multiple Indexes 8

Same name and namespace in other branches
  1. 7 lib/Drupal/SearchApiSolr/SearchApiAcquiaSearchMultiService.php \SearchApiAcquiaSearchMultiService::setConnectionOptions()
3 calls to SearchApiAcquiaSearchMultiService::setConnectionOptions()
SearchApiAcquiaSearchMultiService::connect in src/Plugin/search_api/backend/SearchApiAcquiaSearchMultiService.php
SearchApiAcquiaSearchMultiService::getExtraInformation in src/Plugin/search_api/backend/SearchApiAcquiaSearchMultiService.php
SearchApiAcquiaSearchMultiService::viewSettings in src/Plugin/search_api/backend/SearchApiAcquiaSearchMultiService.php

File

src/Plugin/search_api/backend/SearchApiAcquiaSearchMultiService.php, line 27
Contains SearchApiAcquiaSearchMultiService.

Class

SearchApiAcquiaSearchMultiService
Provides automatic environment switching for Acquia Search servers.

Code

public function setConnectionOptions() {
  $has_id = isset($this->options['acquia_override_subscription']['acquia_override_subscription_id']) ? true : false;
  $has_key = isset($this->options['acquia_override_subscription']['acquia_override_subscription_key']) ? true : false;
  $has_corename = isset($this->options['acquia_override_subscription']['acquia_override_subscription_corename']) ? true : false;
  if ($has_id && $has_key && $has_corename) {
    $identifier = $this->options['acquia_override_subscription']['acquia_override_subscription_id'];
    $key = $this->options['acquia_override_subscription']['acquia_override_subscription_key'];
    $corename = $this->options['acquia_override_subscription']['acquia_override_subscription_corename'];
    $this->options['path'] = '/solr/' . $corename;

    // Set the derived key for this environment.
    $subscription = $this
      ->getAcquiaSubscription($identifier, $key);
    if (!$this
      ->getAcquiaSubscriptionError($subscription, $identifier)) {
      $derived_key_salt = $subscription['derived_key_salt'];
      $derived_key = _acquia_search_multi_subs_create_derived_key($derived_key_salt, $corename, $key);
      $this->options['derived_key'] = $derived_key;

      // Get and set our search core hostname.
      $search_host = acquia_search_multi_subs_get_hostname($corename);
      $this->options['host'] = $search_host;
    }
  }
  else {
    parent::setConnectionOptions();
  }
}