Removing auto-start from CakeSession. Lazy starting will be more performant in most cases.

This commit is contained in:
mark_story 2010-12-09 23:41:07 -05:00
parent 2fe60142f5
commit 9e1c85e627

View file

@ -151,15 +151,9 @@ class CakeSession {
if (($checkAgent === true || $checkAgent === null) && env('HTTP_USER_AGENT') != null) { if (($checkAgent === true || $checkAgent === null) && env('HTTP_USER_AGENT') != null) {
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt')); self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
} }
if ($start === true) {
self::_setPath($base); self::_setPath($base);
self::_setHost(env('HTTP_HOST')); self::_setHost(env('HTTP_HOST'));
} }
if (isset($_SESSION) || $start === true) {
self::start();
}
}
/** /**
* Setup the Path variable * Setup the Path variable
@ -374,12 +368,12 @@ class CakeSession {
* @return mixed The value of the session variable * @return mixed The value of the session variable
*/ */
public static function read($name = null) { public static function read($name = null) {
if (is_null($name)) {
return self::__returnSessionVars();
}
if (empty($name)) { if (empty($name)) {
return false; return false;
} }
if (is_null($name)) {
return self::__returnSessionVars();
}
$result = Set::classicExtract($_SESSION, $name); $result = Set::classicExtract($_SESSION, $name);
if (!is_null($result)) { if (!is_null($result)) {