Use SESSION_DURATION option to define the session lifetime stored in the

database

The option `SESSION_DURATION` is used to define the cookie lifetime.

With this change, Kanboard will try to use first `SESSION_DURATION` instead of the
default `session.gc_maxlifetime` value.

Fixes #4340
This commit is contained in:
Frédéric Guillot 2023-04-10 21:11:09 -07:00 committed by Frédéric Guillot
parent 1c90a0ce57
commit 4adb93c1a6
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ class SessionHandler implements SessionHandlerInterface
#[\ReturnTypeWillChange]
public function write($sessionID, $data)
{
$lifetime = time() + (ini_get('session.gc_maxlifetime') ?: 1440);
if (SESSION_DURATION > 0) {
$lifetime = time() + SESSION_DURATION;
} else {
$lifetime = time() + (ini_get('session.gc_maxlifetime') ?: 1440);
}
$this->db->startTransaction();