/**
  * Set some special overrides for Acquia Search
  */
 public function setConnectionOptions()
 {
     // Modify connection details live on every connect so we do not need to
     // resave the server details if we make modifications in settings.php.
     $identifier = acquia_agent_settings('acquia_identifier');
     $subscription = acquia_agent_settings('acquia_subscription_data');
     $search_host = variable_get('acquia_search_host', '');
     if (!empty($subscription['heartbeat_data']['search_service_colony'])) {
         $search_host = $subscription['heartbeat_data']['search_service_colony'];
     }
     // Get our default port
     $search_port = variable_get('acquia_search_port', '80');
     // Get our solr path
     $search_path = variable_get('acquia_search_path', '/solr/' . $identifier);
     $this->options['host'] = $search_host;
     $this->options['path'] = $search_path;
     $this->options['port'] = $search_port;
     // We can also have overrides per server setting.
     // Apply the overrides in the "search_api_acquia_overrides" variable.
     $name = $this->server->machine_name;
     $overrides = variable_get('search_api_acquia_overrides', array());
     if (isset($overrides[$name]) && is_array($overrides[$name])) {
         $this->options = array_merge($this->options, $overrides[$name]);
     }
 }
 /**
  * Derive a key for the solr hmac using the information shared with
  * acquia.com.
  *
  * @see _acquia_search_derived_key()
  */
 public function getDerivedKey()
 {
     if (!isset($this->derivedKey)) {
         $key = acquia_agent_settings('acquia_key');
         $subscription = acquia_agent_settings('acquia_subscription_data');
         $identifier = acquia_agent_settings('acquia_identifier');
         // We use a salt from acquia.com in key derivation since this is a shared
         // value that we could change on the AN side if needed to force any
         // or all clients to use a new derived key.  We also use a string
         // ('solr') specific to the service, since we want each service using a
         // derived key to have a separate one.
         if (empty($subscription['active']) || empty($key) || empty($identifier)) {
             // Expired or invalid subscription - don't continue.
             $this->derivedKey = '';
         } else {
             $salt = isset($subscription['derived_key_salt']) ? $subscription['derived_key_salt'] : '';
             $derivation_string = $identifier . 'solr' . $salt;
             $this->derivedKey = hash_hmac('sha1', str_pad($derivation_string, 80, $derivation_string), $key);
         }
     }
     return $this->derivedKey;
 }