function update_get_d6_session_name

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()

File

includes/update.inc, line 895
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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!update.inc/function/update_get_d6_session_name/7.x