Moved session set handler out of the Session class.
This commit is contained in:
parent
8206239d59
commit
24770b2e9c
2 changed files with 13 additions and 13 deletions
|
@ -108,9 +108,9 @@ class Session extends Object
|
|||
* Constructor
|
||||
*
|
||||
* All of our set up logic for the session in contained here. This object
|
||||
* is initially instantiated from pickles.php and does nothing more than
|
||||
* the instantiation. All variables are driven from php.ini and/or the
|
||||
* site config. Once configured, the session is started
|
||||
* is initially instantiated and the event handler is set from pickles.php
|
||||
* All variables are driven from php.ini and/or the site config. Once
|
||||
* configured, the session is started automatically.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -130,16 +130,6 @@ class Session extends Object
|
|||
// Gets a database instance
|
||||
$this->db = Database::getInstance($this->datasource);
|
||||
|
||||
// Sets up the session handler
|
||||
session_set_save_handler(
|
||||
array($this, 'open'),
|
||||
array($this, 'close'),
|
||||
array($this, 'read'),
|
||||
array($this, 'write'),
|
||||
array($this, 'destroy'),
|
||||
array($this, 'gc')
|
||||
);
|
||||
|
||||
register_shutdown_function('session_write_close');
|
||||
session_start();
|
||||
}
|
||||
|
|
10
pickles.php
10
pickles.php
|
@ -95,6 +95,16 @@ if (isset($config->pickles['session']))
|
|||
if (isset($_REQUEST['request']) == false || preg_match('/^__pickles\/(css|js)\/.+$/', $_REQUEST['request']) == false)
|
||||
{
|
||||
$session = new Session();
|
||||
|
||||
// Sets up the session handler
|
||||
session_set_save_handler(
|
||||
array($session, 'open'),
|
||||
array($session, 'close'),
|
||||
array($session, 'read'),
|
||||
array($session, 'write'),
|
||||
array($session, 'destroy'),
|
||||
array($session, 'gc')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue