From b7b5451a7f0fd881ff29a91512bba626879bf5f4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 8 Oct 2011 23:53:13 -0500 Subject: [PATCH] refactoring session handling. --- laravel/facades.php | 2 -- laravel/session/manager.php | 27 ++------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/laravel/facades.php b/laravel/facades.php index f875ed29..a2e82d9d 100644 --- a/laravel/facades.php +++ b/laravel/facades.php @@ -32,6 +32,4 @@ public static function __callStatic($method, $parameters) } -class Crypter extends Facade { public static $resolve = 'laravel.crypter'; } -class Hasher extends Facade { public static $resolve = 'laravel.hasher'; } class Session extends Facade { public static $resolve = 'laravel.session'; } \ No newline at end of file diff --git a/laravel/session/manager.php b/laravel/session/manager.php index c5d905df..b49b71bf 100644 --- a/laravel/session/manager.php +++ b/laravel/session/manager.php @@ -21,13 +21,6 @@ class Manager { */ private $transporter; - /** - * The session payload instance. - * - * @var Payload - */ - private $payload; - /** * Indicates if the session exists in persistent storage. * @@ -61,7 +54,7 @@ public function payload($config) // If the session is expired, a new session will be generated and all of the data from // the previous session will be lost. The new session will be assigned a random, long // string ID to uniquely identify it among the application's current users. - if (is_null($session) or $this->expired($session, $config)) + if (is_null($session) or (time() - $session['last_activity']) > ($config['lifetime'] * 60)) { $this->exists = false; @@ -82,19 +75,6 @@ public function payload($config) return $payload; } - /** - * Deteremine if the session is expired based on the last activity timestamp - * and the session lifetime set in the configuration file. - * - * @param array $session - * @param array $config - * @return bool - */ - private function expired($session, $config) - { - return (time() - $session['last_activity']) > ($config['lifetime'] * 60); - } - /** * Close the session handling for the request. * @@ -107,10 +87,7 @@ public function close(Payload $payload, $config, $flash = array()) { // If the session ID has been regenerated, we will need to inform the session driver // that the session will need to be persisted to the data store as a new session. - if ($payload->regenerated) - { - $this->exists = false; - } + if ($payload->regenerated) $this->exists = false; foreach ($flash as $key => $value) {