summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2022-03-03 00:20:55 +0100
committerAndrey Andreev <narf@devilix.net>2022-03-03 00:20:55 +0100
commit3378180483140fa9251e50843bda15a508e85e89 (patch)
tree5511462e595ccd3d40033d5c2ec01154ff2aa7eb /system/libraries/Session/drivers
parentbb7192e43b251cb9620b35859f6283e80897c331 (diff)
parent4196eb22d7aa2f9d8325865567c2cbb82fd70960 (diff)
Merge branch '3.1-stable' into develop
Diffstat (limited to 'system/libraries/Session/drivers')
-rw-r--r--system/libraries/Session/drivers/Session_database_driver.php29
-rw-r--r--system/libraries/Session/drivers/Session_files_driver.php20
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php20
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php20
4 files changed, 81 insertions, 8 deletions
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index 2f788a1a1..4b475364b 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -345,15 +345,40 @@ class CI_Session_database_driver extends CI_Session_driver implements CI_Session
// --------------------------------------------------------------------
/**
+ * Update Timestamp
+ *
+ * Update session timestamp without modifying data
+ *
+ * @param string $id Session ID
+ * @param string $data Unknown & unused
+ * @return bool
+ */
+ public function updateTimestamp($id, $unknown)
+ {
+ // Prevent previous QB calls from messing with our queries
+ $this->_db->reset_query();
+
+ $this->_db->where('id', $id);
+ if ($this->_config['match_ip'])
+ {
+ $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']);
+ }
+
+ return (bool) $this->_db->update($this->_config['save_path'], array('timestamp' => time()));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Validate ID
*
* Checks whether a session ID record exists server-side,
* to enforce session.use_strict_mode.
*
- * @param string $id
+ * @param string $id Session ID
* @return bool
*/
- public function validateSessionId($id)
+ public function validateId($id)
{
// Prevent previous QB calls from messing with our queries
$this->_db->reset_query();
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index c912fc71d..be0dc9ede 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -401,15 +401,31 @@ class CI_Session_files_driver extends CI_Session_driver implements CI_Session_dr
// --------------------------------------------------------------------
/**
+ * Update Timestamp
+ *
+ * Update session timestamp without modifying data
+ *
+ * @param string $id Session ID
+ * @param string $data Unknown & unused
+ * @return bool
+ */
+ public function updateTimestamp($id, $unknown)
+ {
+ return touch($this->_file_path.$id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Validate ID
*
* Checks whether a session ID record exists server-side,
* to enforce session.use_strict_mode.
*
- * @param string $id
+ * @param string $id Session ID
* @return bool
*/
- public function validateSessionId($id)
+ public function validateId($id)
{
$result = is_file($this->_file_path.$id);
clearstatcache(TRUE, $this->_file_path.$id);
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index d84a9df1d..d1401630d 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -296,15 +296,31 @@ class CI_Session_memcached_driver extends CI_Session_driver implements CI_Sessio
// --------------------------------------------------------------------
/**
+ * Update Timestamp
+ *
+ * Update session timestamp without modifying data
+ *
+ * @param string $id Session ID
+ * @param string $data Unknown & unused
+ * @return bool
+ */
+ public function updateTimestamp($id, $unknown)
+ {
+ return $this->_memcached->touch($this->_key_prefix.$id, $this->_config['expiration']);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Validate ID
*
* Checks whether a session ID record exists server-side,
* to enforce session.use_strict_mode.
*
- * @param string $id
+ * @param string $id Session ID
* @return bool
*/
- public function validateSessionId($id)
+ public function validateId($id)
{
$this->_memcached->get($this->_key_prefix.$id);
return ($this->_memcached->getResultCode() === Memcached::RES_SUCCESS);
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index fae024bee..2614aa37e 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -382,15 +382,31 @@ class CI_Session_redis_driver extends CI_Session_driver implements CI_Session_dr
// --------------------------------------------------------------------
/**
+ * Update Timestamp
+ *
+ * Update session timestamp without modifying data
+ *
+ * @param string $id Session ID
+ * @param string $data Unknown & unused
+ * @return bool
+ */
+ public function updateTimestamp($id, $unknown)
+ {
+ return $this->_redis->{$this->_setTimeout_name}($this->_key_prefix.$id, $this->_config['expiration']);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Validate ID
*
* Checks whether a session ID record exists server-side,
* to enforce session.use_strict_mode.
*
- * @param string $id
+ * @param string $id Session ID
* @return bool
*/
- public function validateSessionId($id)
+ public function validateId($id)
{
return (bool) $this->_redis->exists($this->_key_prefix.$id);
}