You are here

function acquia_search_derived_key_salt in Acquia Search 6

Same name and namespace in other branches
  1. 6.3 acquia_search.module \acquia_search_derived_key_salt()

Returns the subscription's salt used to generate the derived key.

The salt is stored in a system variable so that this module can continue connecting to Acquia Search even when the subscription data is not available. The most common reason for subscription data being unavailable is a failed heartbeat connection to rpc.acquia.com.

Acquia Connector versions <= 7.x-2.7 pulled the derived key salt directly from the subscription data. In order to allow for seamless upgrades, this function checks whether the system variable exists and sets it with the data in the subscription if it doesn't.

Return value

string The derived key salt.

See also

http://drupal.org/node/1784114

1 call to acquia_search_derived_key_salt()
_acquia_search_derived_key in ./acquia_search.module
Derive a key for the solr hmac using the information shared with acquia.com.
3 string references to 'acquia_search_derived_key_salt'
acquia_search_delete_variables in ./acquia_search.module
Helper function to clear variables we may have set.
acquia_search_uninstall in ./acquia_search.install
Implementation of hook_uninstall().
_acquia_search_set_variables in ./acquia_search.module
Helper function - set apachesolr variables to Acquia values..

File

./acquia_search.module, line 289
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_derived_key_salt() {
  $salt = variable_get('acquia_search_derived_key_salt', '');
  if (!$salt) {

    // If the variable doesn't exist, set it using the subscription data.
    $subscription = acquia_agent_settings('acquia_subscription_data');
    if (isset($subscription['derived_key_salt'])) {
      variable_set('acquia_search_derived_key_salt', $subscription['derived_key_salt']);
      $salt = $subscription['derived_key_salt'];
    }
  }
  return $salt;
}