function update_get_d6_session_name
Constructs a session name compatible with a D6 environment.
Return value
D6-compatible session name string.
See also
2 calls to update_get_d6_session_name()
- update_prepare_d7_bootstrap in includes/
update.inc - Performs extra steps required to bootstrap when using a Drupal 6 database.
- UpgradePathTestCase::prepareD7Session in modules/
simpletest/ tests/ upgrade/ upgrade.test - Prepares the appropriate session for the release of Drupal being upgraded.
File
-
includes/
update.inc, line 895
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.