Skip to content
Snippets Groups Projects
Commit e49e8ff1 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #1111 from greezybacon/issue/860


session: Override PHP default for session lifetime

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 24dbf6e5 709c5975
No related branches found
No related tags found
No related merge requests found
......@@ -22,9 +22,7 @@ class osTicketSession {
var $id = '';
function osTicketSession($ttl=0){
$this->ttl =$ttl?$ttl:get_cfg_var('session.gc_maxlifetime');
if(!$this->ttl)
$this->ttl=SESSION_TTL;
$this->ttl = $ttl ?: ini_get('session.gc_maxlifetime') ?: SESSION_TTL;
// Set osTicket specific session name.
session_name('OSTSESSID');
......@@ -32,6 +30,9 @@ class osTicketSession {
// Forced cleanup on shutdown
register_shutdown_function('session_write_close');
// Set session cleanup time to match TTL
ini_set('session.gc_maxlifetime', $ttl);
if (OsticketConfig::getDBVersion())
return session_start();
......@@ -45,7 +46,7 @@ class osTicketSession {
// Remote port specification, as it will make an invalid domain
list($domain) = explode(':', $_SERVER['HTTP_HOST']);
session_set_cookie_params(86400, ROOT_PATH, $domain,
session_set_cookie_params($ttl, ROOT_PATH, $domain,
osTicket::is_https());
//Set handlers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment