Add convenient method to create new session records

pull/5450/head
Aleksander Machniak 8 years ago
parent 5c5f9c381c
commit 8c75dd3aa8

@ -179,6 +179,24 @@ abstract class rcube_session
$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
*/

Loading…
Cancel
Save