You are here

function acquia_search_derived_key_salt in Acquia Connector 7.3

Same name and namespace in other branches
  1. 7.2 acquia_search/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

2 calls to acquia_search_derived_key_salt()
acquia_search_get_derived_key_for_core in acquia_search/acquia_search.module
Returns derived key for the given core ID.
_acquia_search_derived_key in acquia_search/acquia_search.module
Get derived key for solr hmac using the information shared with acquia.com.
3 string references to 'acquia_search_derived_key_salt'
acquia_search_disable in acquia_search/acquia_search.install
Implements hook_disable().
acquia_search_solr_settings_form_new_environment_submit in acquia_search/acquia_search.module
Additional submit handler which creates preconfigured search environment.
acquia_search_uninstall in acquia_search/acquia_search.install
Implements hook_uninstall().

File

acquia_search/acquia_search.module, line 774
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;
}