function update_get_d6_session_name

7.x update.inc update_get_d6_session_name()

Constructs a session name compatible with a D6 environment.

Return value

D6-compatible session name string.

See also

drupal_settings_initialize()

1 call to update_get_d6_session_name()
update_prepare_d7_bootstrap in drupal-7.x/includes/update.inc
Performs extra steps required to bootstrap when using a Drupal 6 database.

File

drupal-7.x/includes/update.inc, line 887
Drupal database update API.

Code

function update_get_d6_session_name() {
  global $base_url, $cookie_domain;
  $cookie_secure = ini_get('session.cookie_secure');

  // If a custom cookie domain is set in settings.php, that variable forms
  // the basis of the session name. Re-compute the D7 hashing method to find
  // out if $cookie_domain was used as the session name.
  if (($cookie_secure ? 'SSESS' : 'SESS') . substr(hash('sha256', $cookie_domain), 0, 32) == session_name()) {
    $session_name = $cookie_domain;
  }
  else {
    // Otherwise use $base_url as session name, without the protocol
    // to use the same session identifiers across HTTP and HTTPS.
    list(, $session_name) = explode('://', $base_url, 2);
  }

  if ($cookie_secure) {
    $session_name .= 'SSL';
  }

  return 'SESS' . md5($session_name);
}