check session validity by DatabaseSessionHandler
This commit is contained in:
parent
0da1d00c3d
commit
19c1bbb522
@ -13,14 +13,17 @@ class DatabaseSessionHandler implements ISessionHandler
|
||||
|
||||
private string $table;
|
||||
|
||||
private DateTime $shouldBeNewerThan;
|
||||
|
||||
private bool $exists = false;
|
||||
|
||||
private bool $written = false;
|
||||
|
||||
public function __construct(IConnection $dbConnection, string $table)
|
||||
public function __construct(IConnection $dbConnection, string $table, DateTime $shouldBeNewerThan)
|
||||
{
|
||||
$this->dbConnection = $dbConnection;
|
||||
$this->table = $table;
|
||||
$this->shouldBeNewerThan = $shouldBeNewerThan;
|
||||
}
|
||||
|
||||
public function open($savePath, $sessionName): bool
|
||||
@ -38,6 +41,7 @@ class DatabaseSessionHandler implements ISessionHandler
|
||||
$select = new Select($this->dbConnection, $this->table);
|
||||
$select->columns(['data']);
|
||||
$select->whereId(substr($id, 0, 32));
|
||||
$select->where('updated', '>=', $this->shouldBeNewerThan->format('Y-m-d H:i:s'));
|
||||
|
||||
$result = $select->execute()->fetch(IResultSet::FETCH_ASSOC);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user