summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Session.php17
-rw-r--r--system/libraries/drivers/Session/Cache.php5
-rw-r--r--system/libraries/drivers/Session/Cookie.php5
-rw-r--r--system/libraries/drivers/Session/Database.php5
4 files changed, 28 insertions, 4 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index e03f5dff..670ee6a6 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -2,7 +2,7 @@
/**
* Session library.
*
- * $Id: Session.php 4073 2009-03-13 17:53:58Z Shadowhand $
+ * $Id: Session.php 4433 2009-07-01 03:44:20Z kiall $
*
* @package Core
* @author Kohana Team
@@ -27,6 +27,9 @@ class Session_Core {
// Input library
protected $input;
+ // Automatically save the session by default
+ public static $should_save = true;
+
/**
* Singleton instance of Session.
*/
@@ -455,4 +458,16 @@ class Session_Core {
}
}
+ /**
+ * Do not save this session.
+ * This is a performance feature only, if using the native
+ * session "driver" the save will NOT be aborted.
+ *
+ * @return void
+ */
+ public function abort_save()
+ {
+ Session::$should_save = FALSE;
+ }
+
} // End Session Class
diff --git a/system/libraries/drivers/Session/Cache.php b/system/libraries/drivers/Session/Cache.php
index 7221c9f2..45e49495 100644
--- a/system/libraries/drivers/Session/Cache.php
+++ b/system/libraries/drivers/Session/Cache.php
@@ -10,7 +10,7 @@
* Lifetime does not need to be set as it is
* overridden by the session expiration setting.
*
- * $Id: Cache.php 3769 2008-12-15 00:48:56Z zombor $
+ * $Id: Cache.php 4431 2009-07-01 03:41:41Z kiall $
*
* @package Core
* @author Kohana Team
@@ -76,6 +76,9 @@ class Session_Cache_Driver implements Session_Driver {
public function write($id, $data)
{
+ if ( ! Session::$should_save)
+ return TRUE;
+
$id = 'session_'.$id;
$data = Kohana::config('session.encryption') ? $this->encrypt->encode($data) : $data;
diff --git a/system/libraries/drivers/Session/Cookie.php b/system/libraries/drivers/Session/Cookie.php
index 7b791064..4cf18fc2 100644
--- a/system/libraries/drivers/Session/Cookie.php
+++ b/system/libraries/drivers/Session/Cookie.php
@@ -2,7 +2,7 @@
/**
* Session cookie driver.
*
- * $Id: Cookie.php 3769 2008-12-15 00:48:56Z zombor $
+ * $Id: Cookie.php 4431 2009-07-01 03:41:41Z kiall $
*
* @package Core
* @author Kohana Team
@@ -48,6 +48,9 @@ class Session_Cookie_Driver implements Session_Driver {
public function write($id, $data)
{
+ if ( ! Session::$should_save)
+ return TRUE;
+
$data = empty($this->encrypt) ? base64_encode($data) : $this->encrypt->encode($data);
if (strlen($data) > 4048)
diff --git a/system/libraries/drivers/Session/Database.php b/system/libraries/drivers/Session/Database.php
index b4144ffb..490875a1 100644
--- a/system/libraries/drivers/Session/Database.php
+++ b/system/libraries/drivers/Session/Database.php
@@ -2,7 +2,7 @@
/**
* Session database driver.
*
- * $Id: Database.php 3769 2008-12-15 00:48:56Z zombor $
+ * $Id: Database.php 4431 2009-07-01 03:41:41Z kiall $
*
* @package Core
* @author Kohana Team
@@ -98,6 +98,9 @@ class Session_Database_Driver implements Session_Driver {
public function write($id, $data)
{
+ if ( ! Session::$should_save)
+ return TRUE;
+
$data = array
(
'session_id' => $id,