Add convenient method to create new session records

pull/5754/head
Aleksander Machniak 8 years ago committed by Aleksander Machniak
parent 7983a7d63f
commit 115d575421

@ -179,6 +179,24 @@ abstract class rcube_session
$this->gc_shutdown(); $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 * Merge vars with old vars and apply unsets
*/ */

Loading…
Cancel
Save