public function SearchSubscriber::getDerivedKeySalt in Acquia Search 2.x
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.
File
- src/
EventSubscriber/ SearchSubscriber.php, line 274
Class
- SearchSubscriber
- Extends Solarium plugin: authenticate, etc.
Namespace
Drupal\acquia_search\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::state()
->get('acquia_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;
}