Skip to content

Commit

Permalink
Add convenient method to create new session records
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Nov 15, 2016
1 parent 7983a7d commit 115d575
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions program/lib/Roundcube/rcube_session.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,24 @@ public function write_close()
$this->gc_shutdown();
}

/**
* Creates a new (separate) session
*
* @param array Session data
*
* @return string Session identifier (on success)
*/
public function create($data)
{
$length = strlen(session_id());
$key = rcube_utils::random_bytes($length);

// create new session
if ($this->write($key, $this->serialize($data))) {
return $key;
}
}

/**
* Merge vars with old vars and apply unsets
*/
Expand Down

0 comments on commit 115d575

Please sign in to comment.