/** * Updates the current session ID with a newly generated one . * Please refer to <http://php.net/session_regenerate_id> for more details. * @param boolean $deleteOldSession Whether to delete the old associated session file or not. */ public function regenerateID($deleteOldSession = false) { if ($this->dbSession) { return $this->dbSession->regenerateID($deleteOldSession); } else { parent::regenerateID($deleteOldSession); } }
/** * Updates the current session ID with a newly generated one. * Please refer to <http://php.net/session_regenerate_id> for more details. * @param boolean $deleteOldSession Whether to delete the old associated session file or not. */ public function regenerateID($deleteOldSession = false) { $oldID = session_id(); // if no session is started, there is nothing to regenerate if (empty($oldID)) { return; } parent::regenerateID(false); $newID = session_id(); $collection = $this->db->getCollection($this->sessionCollection); $row = $collection->findOne(['id' => $oldID]); if ($row !== null) { if ($deleteOldSession) { $collection->update(['id' => $oldID], ['id' => $newID]); } else { unset($row['_id']); $row['id'] = $newID; $collection->insert($row); } } else { // shouldn't reach here normally $collection->insert(['id' => $newID, 'expire' => time() + $this->getTimeout()]); } }
/** * Updates the current session ID with a newly generated one . * Please refer to <http://php.net/session_regenerate_id> for more details. * @param boolean $deleteOldSession Whether to delete the old associated session file or not. */ public function regenerateID($deleteOldSession = false) { $oldID = session_id(); // if no session is started, there is nothing to regenerate if (empty($oldID)) { return; } parent::regenerateID(false); $newID = session_id(); $query = new Query(); $row = $query->from($this->sessionTable)->where(['id' => $oldID])->createCommand($this->db)->queryOne(); if ($row !== false) { if ($deleteOldSession) { $this->db->createCommand()->update($this->sessionTable, ['id' => $newID], ['id' => $oldID])->execute(); } else { $row['id'] = $newID; $this->db->createCommand()->insert($this->sessionTable, $row)->execute(); } } else { // shouldn't reach here normally $this->db->createCommand()->insert($this->sessionTable, ['id' => $newID, 'expire' => time() + $this->getTimeout()])->execute(); } }
/** * Updates the current session id with a newly generated one. * Please refer to {@link http://php.net/session_regenerate_id} for more details. * @param boolean $deleteOldSession Whether to delete the old associated session file or not. * @since 1.1.8 */ public function regenerateID($deleteOldSession = false) { $oldId = session_id(); parent::regenerateID(false); $newId = session_id(); $row = $this->getData($oldId); if (!is_null($row)) { if ($deleteOldSession) { // Delete + Put = Update $this->dynamoDb->deleteItem(array('TableName' => $this->tableName, 'Key' => array('id' => array('S' => (string) $oldId)))); $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($this->idColumn => array('S' => (string) $newId), $this->dataColumn => $row[$this->dataColumn], $this->expireColumn => $row[$this->expireColumn]))); } else { $row[$this->idColumn] = array('S' => (string) $newId); $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($row))); } } else { $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($this->idColumn => array('S' => $newId), $this->expireColumn => array('N' => $this->getExpireTime())))); } }