public function SearchSubscriber::getDerivedKeySalt in Acquia Search Multiple Indexes 8
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 SearchSubscriber::getDerivedKeySalt()
- SearchSubscriber::getDerivedKey in src/
EventSubscriber/ SearchSubscriber.php - Get the derived key for the solr hmac using the information shared with acquia.com.
File
- src/
EventSubscriber/ SearchSubscriber.php, line 188
Class
Namespace
Drupal\acquia_search_multi_subs\EventSubscriberCode
public function getDerivedKeySalt() {
$salt = \Drupal::config('acquia_search.settings')
->get('derived_key_salt');
if (!$salt) {
// If the variable doesn't exist, set it using the subscription data.
$subscription = \Drupal::config('acquia_connector.settings')
->get('subscription_data');
if (isset($subscription['derived_key_salt'])) {
\Drupal::configFactory()
->getEditable('acquia_search.settings')
->set('derived_key_salt', $subscription['derived_key_salt'])
->save();
$salt = $subscription['derived_key_salt'];
}
}
return $salt;
}