91 if ($this->started && !$this->closed) {
95 if (!session_start()) {
96 throw new \RuntimeException(
'Failed to start the session');
99 $this->started =
true;
100 $this->closed =
false;
108 public function regenerate($destroy =
false, $lifetime = null) {
109 if (null !== $lifetime) {
110 ini_set(
'session.cookie_lifetime', $lifetime);
113 return session_regenerate_id($destroy);
120 session_write_close();
122 $this->closed =
true;
136 if (!$this->started) {
147 if ($this->started) {
148 throw new \RuntimeException(
'Cannot change the ID of an active session');
158 return session_name();
172 if (!$this->started) {
176 return array_key_exists(
$name, $_SESSION);
183 if (!$this->started) {
193 if (!$this->started) {
203 if (!$this->started) {
213 if (!$this->started) {
226 if (!$this->started) {
230 if (array_key_exists(
$name, $_SESSION)) {
231 $retval = $_SESSION[
$name];
232 unset($_SESSION[
$name]);
242 if (!$this->started) {
259 $validOptions = array_flip(array(
260 'cache_limiter',
'cookie_domain',
'cookie_httponly',
261 'cookie_lifetime',
'cookie_path',
'cookie_secure',
262 'entropy_file',
'entropy_length',
'gc_divisor',
263 'gc_maxlifetime',
'gc_probability',
'hash_bits_per_character',
264 'hash_function',
'name',
'referer_check',
265 'serialize_handler',
'use_cookies',
266 'use_only_cookies',
'use_trans_sid',
'upload_progress.enabled',
267 'upload_progress.cleanup',
'upload_progress.prefix',
'upload_progress.name',
268 'upload_progress.freq',
'upload_progress.min-freq',
'url_rewriter.tags',
272 if (isset($validOptions[
$key])) {
273 ini_set(
'session.' . $key,
$value);
285 session_set_save_handler(
if($guid==elgg_get_logged_in_user_guid()) $name
__construct(array $options=array(),\Elgg\Http\SessionHandler $handler=null)
Constructor.
save()
{Force the session to be saved and closed.This method must invoke session_write_close() unless this i...
setId($id)
{Sets the session ID.Session string void}
setOptions(array $options)
Sets session.
regenerate($destroy=false, $lifetime=null)
{Regenerates id that represents this storage.This method must invoke session_regenerate_id($destroy) ...
clear()
{Clears all attributes.void}
getId()
{Returns the session ID.string The session ID or empty.}
has($name)
{Checks if an attribute is defined.The attribute nameboolean}
getName()
{Returns the session name.string The session name.}
replace(array $attributes)
{Replaces all attributes.Attributes void}
setName($name)
{Sets the session name.Session name. void}
isStarted()
{Checks if the session is started.boolean True if started, false otherwise.}
start()
{Starts the session.boolean True if started. }
if(!$collection_name) $id
all()
{Returns all attributes.array Attributes}
setHandler($handler)
Set the session handler class with PHP.