drupal_get_private_key

Versions
4.6 – 7
drupal_get_private_key()

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

Return value

The private key.

▾ 2 functions call drupal_get_private_key()

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

Code

includes/common.inc, line 2516

<?php
function drupal_get_private_key() {
  if (!($key = variable_get('drupal_private_key', 0))) {
    $key = md5(uniqid(mt_rand(), true)) . md5(uniqid(mt_rand(), true));
    variable_set('drupal_private_key', $key);
  }
  return $key;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.