JSession/restart: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
| Line 46: | Line 46: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=restart | category=restart | ||
category=JSession | category=JSession | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 02:03, 25 March 2017
Description
Restart an expired or locked session.
Syntax
restart()
Returns
boolean true on success
Defined in
libraries/joomla/session/session.php
Importing
jimport( 'joomla.session.session' );
Source Body
public function restart()
{
$this->destroy();
if ($this->_state !== 'destroyed') {
// @TODO :: generated error here
return false;
}
// Re-register the session handler after a session has been destroyed, to avoid PHP bug
$this->_store->register();
$this->_state = 'restart';
//regenerate session id
$id = $this->_createId(strlen($this->getId()));
session_id($id);
$this->_start();
$this->_state = 'active';
$this->_validate();
$this->_setCounter();
return true;
}
Examples
Code Examples