mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°6901 - Enable tracking of iTop active sessions (monitoring) (#568)
Co-authored-by: Molkobain <lajarige.guillaume@free.fr> Co-authored-by: Romain Quetiez <romain.quetiez@combodo.com>
This commit is contained in:
32
sources/SessionTracker/SessionGC.php
Normal file
32
sources/SessionTracker/SessionGC.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\SessionTracker;
|
||||
|
||||
/**
|
||||
* Class SessionGC
|
||||
*
|
||||
* @author Olivier Dain <olivier.dain@combodo.com>
|
||||
* @package Combodo\iTop\SessionTracker
|
||||
* @since 3.1.1 3.2.0 N°6901
|
||||
*/
|
||||
class SessionGC implements \iBackgroundProcess
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function GetPeriodicity()
|
||||
{
|
||||
return 60 * 1; // seconds
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function Process($iTimeLimit)
|
||||
{
|
||||
$iMaxLifetime = ini_get('session.gc_maxlifetime') ?? 1440;
|
||||
$oSessionHandler = new SessionHandler();
|
||||
$iProcessed = $oSessionHandler->gc_with_time_limit($iMaxLifetime, $iTimeLimit);
|
||||
return "processed $iProcessed tasks";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user