Skip to content

Commit

Permalink
Made session's request countdown configurable by setting `Session.req…
Browse files Browse the repository at this point in the history
…uestCountdown` config variable.

Removed unused Session class properties.

Closes #2078
  • Loading branch information
ADmad committed Nov 20, 2013
1 parent a5bf71c commit 0db7ec3
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions Cake/Network/Session.php
Expand Up @@ -78,13 +78,6 @@ class Session {
*/
public static $time = false;

/**
* Cookie lifetime
*
* @var integer
*/
public static $cookieLifeTime;

/**
* Time when this session becomes invalid.
*
Expand All @@ -106,21 +99,14 @@ class Session {
*/
public static $host = null;

/**
* Session timeout multiplier factor
*
* @var integer
*/
public static $timeout = null;

/**
* Number of requests that can occur during a session time without the session being renewed.
* This feature is only used when config value `Session.autoRegenerate` is set to true.
*
* @var integer
* @see Cake\Network\Session::_checkValid()
*/
public static $requestCountdown = 10;
protected static $_requestCountdown = 10;

/**
* Pseudo constructor.
Expand Down Expand Up @@ -629,9 +615,14 @@ protected static function _checkValid() {
static::$valid = false;
return false;
}
if ($config = static::read('Config')) {
$sessionConfig = Configure::read('Session');

$sessionConfig = Configure::read('Session');
$requestCountdown = static::$_requestCountdown;
if (isset($sessionConfig['requestCountdown'])) {
$requestCountdown = $sessionConfig['requestCountdown'];
}

if ($config = static::read('Config')) {
if (static::_validAgentAndTime()) {
static::write('Config.time', static::$sessionTime);
if (isset($sessionConfig['autoRegenerate']) && $sessionConfig['autoRegenerate'] === true) {
Expand All @@ -641,7 +632,7 @@ protected static function _checkValid() {

if ($check < 1) {
static::renew();
static::write('Config.countdown', static::$requestCountdown);
static::write('Config.countdown', $requestCountdown);
}
}
static::$valid = true;
Expand All @@ -653,7 +644,7 @@ protected static function _checkValid() {
} else {
static::write('Config.userAgent', static::$_userAgent);
static::write('Config.time', static::$sessionTime);
static::write('Config.countdown', static::$requestCountdown);
static::write('Config.countdown', $requestCountdown);
static::$valid = true;
}
}
Expand Down

0 comments on commit 0db7ec3

Please sign in to comment.