Same name and namespace in other branches
  1. 4.6.x includes/common.inc \drupal_get_private_key()
  2. 4.7.x includes/common.inc \drupal_get_private_key()
  3. 5.x includes/common.inc \drupal_get_private_key()
  4. 7.x includes/common.inc \drupal_get_private_key()

Ensure the private key variable used to generate tokens is set.

Return value

The private key.

3 calls to drupal_get_private_key()
drupal_get_token in includes/common.inc
Generate a token based on $value, the current user session and private key.
user_pass_rehash in modules/user/user.module
_update_refresh in modules/update/update.fetch.inc
Fetch project info via XML from a central server.

File

includes/common.inc, line 2661
Common functions that many Drupal modules will need to reference.

Code

function drupal_get_private_key() {
  if (!($key = variable_get('drupal_private_key', 0))) {
    $key = drupal_random_key();
    variable_set('drupal_private_key', $key);
  }
  return $key;
}