ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSessionStatistics Class Reference
+ Collaboration diagram for ilSessionStatistics:

Static Public Member Functions

static isActive ()
 Is session statistics active at all? More...
 
static createRawEntry ($a_session_id, $a_session_type, $a_timestamp, $a_user_id)
 Create raw data entry. More...
 
static closeRawEntry ($a_session_id, $a_context=null, $a_expired_at=null)
 Close raw data entry. More...
 
static aggretateRaw ($a_now)
 Aggregate raw session data (older than given time) More...
 
static aggregateRawHelper ($a_begin, $a_end)
 Aggregate statistics data for one slot. More...
 
static getLastMaxedOut ()
 Get latest slot during which sessions were maxed out. More...
 
static getMaxedOutDuration ($a_from, $a_to)
 Get maxed out duration in given timeframe. More...
 
static getNumberOfSessionsByType ($a_from, $a_to)
 Get session counters by type (opened, closed) More...
 
static getActiveSessions ($a_from, $a_to)
 Get active sessions aggregated data. More...
 
static getLastAggregation ()
 Get timestamp of last aggregation. More...
 
static getLimitForSlot ($a_timestamp)
 Get max session setting for given timestamp. More...
 
static updateLimitLog ($a_new_value)
 Log max session setting. More...
 

Data Fields

const SLOT_SIZE = 15
 

Static Protected Member Functions

static getCurrentSlot ($a_now)
 Get next slot to aggregate. More...
 
static getNumberOfActiveRawSessions ($a_time)
 Count number of active sessions at given time. More...
 
static getRawData ($a_begin, $a_end)
 Read raw data for timespan. More...
 
static createNewAggregationSlot ($a_now)
 Create new slot (using table lock) More...
 
static deleteAggregatedRaw ($a_now)
 Remove already aggregated raw data. More...
 

Detailed Description

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 11 of file class.ilSessionStatistics.php.

Member Function Documentation

◆ aggregateRawHelper()

static ilSessionStatistics::aggregateRawHelper (   $a_begin,
  $a_end 
)
static

Aggregate statistics data for one slot.

Parameters
timestamp$a_begin
timestamp$a_end

Definition at line 281 of file class.ilSessionStatistics.php.

References $action, $DIC, $events, $ilDB, $ilSetting, ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_FIRST, ilSession\SESSION_CLOSE_IDLE, ilSession\SESSION_CLOSE_LIMIT, ilSession\SESSION_CLOSE_LOGIN, and ilSession\SESSION_CLOSE_USER.

282  {
283  global $DIC;
284 
285  $ilDB = $DIC['ilDB'];
286  $ilSetting = $DIC['ilSetting'];
287 
288  // "relevant" closing types
289  $separate_closed = array(ilSession::SESSION_CLOSE_USER,
295 
296  // gather/process data (build event timeline)
297  $closed_counter = $events = array();
298  $opened_counter = 0;
299  foreach (self::getRawData($a_begin, $a_end) as $item) {
300  // open/close counters are _not_ time related
301 
302  // we could filter for undefined/invalid closing contexts
303  // and ignore those items, but this would make any debugging
304  // close to impossible
305  // "closed_other" would have been a good idea...
306 
307  // session opened
308  if ($item["start_time"] >= $a_begin) {
309  $opened_counter++;
310  $events[$item["start_time"]][] = 1;
311  }
312  // session closed
313  if ($item["end_time"] && $item["end_time"] <= $a_end) {
314  if (in_array($item["end_context"], $separate_closed)) {
315  $closed_counter[$item["end_context"]]++;
316  } else {
317  $closed_counter[0]++;
318  }
319  $events[$item["end_time"]][] = -1;
320  }
321  }
322 
323  // initialising active statistical values
324  $active_begin = self::getNumberOfActiveRawSessions($a_begin - 1);
325  $active_end = $active_min = $active_max = $active_avg = $active_begin;
326 
327  // parsing events / building avergages
328  if (sizeof($events)) {
329  $last_update_avg = $a_begin - 1;
330  $slot_seconds = self::SLOT_SIZE * 60;
331  $active_avg = 0;
332 
333  // parse all open/closing events
334  ksort($events);
335  foreach ($events as $ts => $actions) {
336  // actions which occur in the same second are "merged"
337  foreach ($actions as $action) {
338  // max
339  if ($action > 0) {
340  $active_end++;
341  }
342  // min
343  else {
344  $active_end--;
345  }
346  }
347 
348  // max
349  if ($active_end > $active_max) {
350  $active_max = $active_end;
351  }
352 
353  // min
354  if ($active_end < $active_min) {
355  $active_min = $active_end;
356  }
357 
358  // avg
359  $diff = $ts - $last_update_avg;
360  $active_avg += $diff / $slot_seconds * $active_end;
361  $last_update_avg = $ts;
362  }
363  unset($actions);
364 
365  // add up to end of slot if needed
366  if ($last_update_avg < $a_end) {
367  $diff = $a_end - $last_update_avg;
368  $active_avg += $diff / $slot_seconds * $active_end;
369  }
370 
371  $active_avg = round($active_avg);
372  }
373  unset($events);
374 
375 
376  // do we (really) need a log here?
377  // $max_sessions = (int)$ilSetting->get("session_max_count", ilSessionControl::DEFAULT_MAX_COUNT);
378  $max_sessions = self::getLimitForSlot($a_begin);
379 
380  // save aggregated data
381  $fields = array(
382  "active_min" => array("integer", $active_min),
383  "active_max" => array("integer", $active_max),
384  "active_avg" => array("integer", $active_avg),
385  "active_end" => array("integer", $active_end),
386  "opened" => array("integer", $opened_counter),
387  "closed_manual" => array("integer", (int) $closed_counter[ilSession::SESSION_CLOSE_USER]),
388  "closed_expire" => array("integer", (int) $closed_counter[ilSession::SESSION_CLOSE_EXPIRE]),
389  "closed_idle" => array("integer", (int) $closed_counter[ilSession::SESSION_CLOSE_IDLE]),
390  "closed_idle_first" => array("integer", (int) $closed_counter[ilSession::SESSION_CLOSE_FIRST]),
391  "closed_limit" => array("integer", (int) $closed_counter[ilSession::SESSION_CLOSE_LIMIT]),
392  "closed_login" => array("integer", (int) $closed_counter[ilSession::SESSION_CLOSE_LOGIN]),
393  "closed_misc" => array("integer", (int) $closed_counter[0]),
394  "max_sessions" => array("integer", (int) $max_sessions)
395  );
396  $ilDB->update(
397  "usr_session_stats",
398  $fields,
399  array("slot_begin" => array("integer", $a_begin),
400  "slot_end" => array("integer", $a_end))
401  );
402  }
const SESSION_CLOSE_IDLE
$action
global $DIC
Definition: saml.php:7
const SESSION_CLOSE_LOGIN
if($argc< 2) $events
const SESSION_CLOSE_EXPIRE
const SESSION_CLOSE_USER
const SESSION_CLOSE_LIMIT
global $ilSetting
Definition: privfeed.php:17
global $ilDB
const SESSION_CLOSE_FIRST

◆ aggretateRaw()

static ilSessionStatistics::aggretateRaw (   $a_now)
static

Aggregate raw session data (older than given time)

Parameters
integer$a_now

Definition at line 259 of file class.ilSessionStatistics.php.

Referenced by ilSession\_writeData(), and ilSessionStatisticsGUI\adminSync().

260  {
261  if (!self::isActive()) {
262  return;
263  }
264 
265  $slot = self::createNewAggregationSlot($a_now);
266  while (is_array($slot)) {
267  self::aggregateRawHelper($slot[0], $slot[1]);
268  $slot = self::createNewAggregationSlot($a_now);
269  }
270 
271  // #12728
272  self::deleteAggregatedRaw($a_now);
273  }
+ Here is the caller graph for this function:

◆ closeRawEntry()

static ilSessionStatistics::closeRawEntry (   $a_session_id,
  $a_context = null,
  $a_expired_at = null 
)
static

Close raw data entry.

Parameters
int | array$a_session_id
int$a_context
int | bool$a_expired_at

Definition at line 75 of file class.ilSessionStatistics.php.

References $DIC, $id, and $ilDB.

Referenced by ilSession\_destroy().

76  {
77  global $DIC;
78 
79  $ilDB = $DIC['ilDB'];
80 
81  if (!self::isActive()) {
82  return;
83  }
84 
85  // single entry
86  if (!is_array($a_session_id)) {
87  if ($a_expired_at) {
88  $end_time = $a_expired_at;
89  } else {
90  $end_time = time();
91  }
92  $sql = "UPDATE usr_session_stats_raw" .
93  " SET end_time = " . $ilDB->quote($end_time, "integer");
94  if ($a_context) {
95  $sql .= ",end_context = " . $ilDB->quote($a_context, "integer");
96  }
97  $sql .= " WHERE session_id = " . $ilDB->quote($a_session_id, "text") .
98  " AND end_time IS NULL";
99  $ilDB->manipulate($sql);
100  }
101  // batch closing
102  elseif (!$a_expired_at) {
103  $sql = "UPDATE usr_session_stats_raw" .
104  " SET end_time = " . $ilDB->quote(time(), "integer");
105  if ($a_context) {
106  $sql .= ",end_context = " . $ilDB->quote($a_context, "integer");
107  }
108  $sql .= " WHERE " . $ilDB->in("session_id", $a_session_id, false, "text") .
109  " AND end_time IS NULL";
110  $ilDB->manipulate($sql);
111  }
112  // batch with individual timestamps
113  else {
114  foreach ($a_session_id as $id => $ts) {
115  $sql = "UPDATE usr_session_stats_raw" .
116  " SET end_time = " . $ilDB->quote($ts, "integer");
117  if ($a_context) {
118  $sql .= ",end_context = " . $ilDB->quote($a_context, "integer");
119  }
120  $sql .= " WHERE session_id = " . $ilDB->quote($id, "text") .
121  " AND end_time IS NULL";
122  $ilDB->manipulate($sql);
123  }
124  }
125  }
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilDB
+ Here is the caller graph for this function:

◆ createNewAggregationSlot()

static ilSessionStatistics::createNewAggregationSlot (   $a_now)
staticprotected

Create new slot (using table lock)

Parameters
integer$a_now
Returns
array begin, end

Definition at line 223 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, and ilDBInterface\insert().

224  {
225  global $DIC;
226 
227  $ilDB = $DIC['ilDB'];
228 
229  $ilAtomQuery = $ilDB->buildAtomQuery();
230  $ilAtomQuery->addTableLock("usr_session_stats");
231 
232  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) use ($a_now, &$slot) {
233 
234  // if we had to wait for the lock, no current slot should be returned here
235  $slot = self::getCurrentSlot($a_now);
236  if (!is_array($slot)) {
237  $slot = false;
238  return;
239  }
240 
241  // save slot to mark as taken
242  $fields = array(
243  "slot_begin" => array("integer", $slot[0]),
244  "slot_end" => array("integer", $slot[1]),
245  );
246  $ilDB->insert("usr_session_stats", $fields);
247  });
248 
249  $ilAtomQuery->run();
250 
251  return $slot;
252  }
global $DIC
Definition: saml.php:7
global $ilDB
insert($table_name, $values)
+ Here is the call graph for this function:

◆ createRawEntry()

static ilSessionStatistics::createRawEntry (   $a_session_id,
  $a_session_type,
  $a_timestamp,
  $a_user_id 
)
static

Create raw data entry.

Parameters
int$a_session_id
int$a_session_type
int$a_timestamp
int$a_user_id

Definition at line 42 of file class.ilSessionStatistics.php.

References $DIC, and $ilDB.

Referenced by ilSession\_writeData(), and ilSessionControl\checkCurrentSessionIsAllowed().

43  {
44  global $DIC;
45 
46  $ilDB = $DIC['ilDB'];
47 
48  if (!$a_user_id || !$a_session_id || !self::isActive()) {
49  return;
50  }
51 
52  // #9669: if a session was destroyed and somehow the session id is still
53  // in use there will be a id-collision for the raw-entry
54 
55  $ilDB->replace(
56  "usr_session_stats_raw",
57  array(
58  "session_id" => array("text", $a_session_id)
59  ),
60  array(
61  "type" => array("integer", $a_session_type),
62  "start_time" => array("integer", $a_timestamp),
63  "user_id" => array("integer", $a_user_id)
64  )
65  );
66  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ deleteAggregatedRaw()

static ilSessionStatistics::deleteAggregatedRaw (   $a_now)
staticprotected

Remove already aggregated raw data.

Parameters
integer$a_now

Definition at line 409 of file class.ilSessionStatistics.php.

References $DIC, and $ilDB.

410  {
411  global $DIC;
412 
413  $ilDB = $DIC['ilDB'];
414 
415  // we are rather defensive here - 7 days BEFORE current aggregation
416  $cut = $a_now - (60 * 60 * 24 * 7);
417 
418  $ilDB->manipulate("DELETE FROM usr_session_stats_raw" .
419  " WHERE start_time <= " . $ilDB->quote($cut, "integer"));
420  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ getActiveSessions()

static ilSessionStatistics::getActiveSessions (   $a_from,
  $a_to 
)
static

Get active sessions aggregated data.

Parameters
int$a_from
int$a_to
Returns
array

Definition at line 499 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, and $row.

Referenced by ilSessionStatisticsGUI\buildData().

500  {
501  global $DIC;
502 
503  $ilDB = $DIC['ilDB'];
504 
505  $sql = "SELECT slot_begin, slot_end, active_min, active_max, active_avg," .
506  " max_sessions" .
507  " FROM usr_session_stats" .
508  " WHERE slot_end > " . $ilDB->quote($a_from, "integer") .
509  " AND slot_begin < " . $ilDB->quote($a_to, "integer") .
510  " ORDER BY slot_begin";
511  $res = $ilDB->query($sql);
512  $all = array();
513  while ($row = $ilDB->fetchAssoc($res)) {
514  $all[] = $row;
515  }
516  return $all;
517  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getCurrentSlot()

static ilSessionStatistics::getCurrentSlot (   $a_now)
staticprotected

Get next slot to aggregate.

Parameters
integer$a_now
Returns
array begin, end

Definition at line 133 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, and $row.

134  {
135  global $DIC;
136 
137  $ilDB = $DIC['ilDB'];
138 
139  // get latest slot in db
140  $sql = "SELECT MAX(slot_end) previous_slot_end" .
141  " FROM usr_session_stats";
142  $res = $ilDB->query($sql);
143  $row = $ilDB->fetchAssoc($res);
144  $previous_slot_end = $row["previous_slot_end"];
145 
146  // no previous slot? calculate last complete slot
147  // should we use minimum session raw date instead? (problem: table lock)
148  if (!$previous_slot_end) {
149  $slot = floor(date("i") / self::SLOT_SIZE);
150  // last slot of previous hour
151  if (!$slot) {
152  $current_slot_begin = mktime(date("H", $a_now) - 1, 60 - self::SLOT_SIZE, 0);
153  }
154  // "normalize" to slot
155  else {
156  $current_slot_begin = mktime(date("H", $a_now), ($slot - 1) * self::SLOT_SIZE, 0);
157  }
158  } else {
159  $current_slot_begin = $previous_slot_end + 1;
160  }
161 
162  $current_slot_end = $current_slot_begin + (60 * self::SLOT_SIZE) - 1;
163 
164  // no complete slot: nothing to do yet
165  if ($current_slot_end < $a_now) {
166  return array($current_slot_begin, $current_slot_end);
167  }
168  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB

◆ getLastAggregation()

static ilSessionStatistics::getLastAggregation ( )
static

Get timestamp of last aggregation.

Returns
timestamp

Definition at line 524 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, and $row.

Referenced by ilSessionStatisticsGUI\renderCurrentBasics().

525  {
526  global $DIC;
527 
528  $ilDB = $DIC['ilDB'];
529 
530  $sql = "SELECT max(slot_end) latest FROM usr_session_stats";
531  $res = $ilDB->query($sql);
532  $row = $ilDB->fetchAssoc($res);
533  if ($row["latest"]) {
534  return $row["latest"];
535  }
536  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getLastMaxedOut()

static ilSessionStatistics::getLastMaxedOut ( )
static

Get latest slot during which sessions were maxed out.

Returns
int timestamp

Definition at line 427 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, and $row.

Referenced by ilSessionStatisticsGUI\renderCurrentBasics().

428  {
429  global $DIC;
430 
431  $ilDB = $DIC['ilDB'];
432 
433  $sql = "SELECT max(slot_end) latest FROM usr_session_stats" .
434  " WHERE active_max >= max_sessions" .
435  " AND max_sessions > " . $ilDB->quote(0, "integer");
436  $res = $ilDB->query($sql);
437  $row = $ilDB->fetchAssoc($res);
438  if ($row["latest"]) {
439  return $row["latest"];
440  }
441  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getLimitForSlot()

static ilSessionStatistics::getLimitForSlot (   $a_timestamp)
static

Get max session setting for given timestamp.

Parameters
timestamp$a_timestamp
Returns
int

Definition at line 544 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $ilSetting, $res, and ilSessionControl\DEFAULT_MAX_COUNT.

545  {
546  global $DIC;
547 
548  $ilDB = $DIC['ilDB'];
549  $ilSetting = $DIC['ilSetting'];
550 
551  $ilDB->setLimit(1);
552  $sql = "SELECT maxval FROM usr_session_log" .
553  " WHERE tstamp <= " . $ilDB->quote($a_timestamp, "integer") .
554  " ORDER BY tstamp DESC";
555  $res = $ilDB->query($sql);
556  $val = $ilDB->fetchAssoc($res);
557  if ($val["maxval"]) {
558  return (int) $val["maxval"];
559  } else {
560  return (int) $ilSetting->get("session_max_count", ilSessionControl::DEFAULT_MAX_COUNT);
561  }
562  }
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet ...
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilSetting
Definition: privfeed.php:17
global $ilDB

◆ getMaxedOutDuration()

static ilSessionStatistics::getMaxedOutDuration (   $a_from,
  $a_to 
)
static

Get maxed out duration in given timeframe.

Parameters
int$a_from
int$a_to
Returns
int seconds

Definition at line 450 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, and $row.

Referenced by ilSessionStatisticsGUI\buildData().

451  {
452  global $DIC;
453 
454  $ilDB = $DIC['ilDB'];
455 
456  $sql = "SELECT SUM(slot_end-slot_begin) dur FROM usr_session_stats" .
457  " WHERE active_max >= max_sessions" .
458  " AND max_sessions > " . $ilDB->quote(0, "integer") .
459  " AND slot_end > " . $ilDB->quote($a_from, "integer") .
460  " AND slot_begin < " . $ilDB->quote($a_to, "integer");
461  $res = $ilDB->query($sql);
462  $row = $ilDB->fetchAssoc($res);
463  if ($row["dur"]) {
464  return $row["dur"];
465  }
466  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getNumberOfActiveRawSessions()

static ilSessionStatistics::getNumberOfActiveRawSessions (   $a_time)
staticprotected

Count number of active sessions at given time.

Parameters
integer$a_time
Returns
integer

Definition at line 176 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, $row, and ilSessionControl\$session_types_controlled.

177  {
178  global $DIC;
179 
180  $ilDB = $DIC['ilDB'];
181 
182  $sql = "SELECT COUNT(*) counter FROM usr_session_stats_raw" .
183  " WHERE (end_time IS NULL OR end_time >= " . $ilDB->quote($a_time, "integer") . ")" .
184  " AND start_time <= " . $ilDB->quote($a_time, "integer") .
185  " AND " . $ilDB->in("type", ilSessionControl::$session_types_controlled, false, "integer");
186  $res = $ilDB->query($sql);
187  $row = $ilDB->fetchAssoc($res);
188  return $row["counter"];
189  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB

◆ getNumberOfSessionsByType()

static ilSessionStatistics::getNumberOfSessionsByType (   $a_from,
  $a_to 
)
static

Get session counters by type (opened, closed)

Parameters
int$a_from
int$a_to
Returns
array

Definition at line 475 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, and $res.

Referenced by ilSessionStatisticsGUI\buildData().

476  {
477  global $DIC;
478 
479  $ilDB = $DIC['ilDB'];
480 
481  $sql = "SELECT SUM(opened) opened, SUM(closed_manual) closed_manual," .
482  " SUM(closed_expire) closed_expire, SUM(closed_idle) closed_idle," .
483  " SUM(closed_idle_first) closed_idle_first, SUM(closed_limit) closed_limit," .
484  " SUM(closed_login) closed_login, SUM(closed_misc) closed_misc" .
485  " FROM usr_session_stats" .
486  " WHERE slot_end > " . $ilDB->quote($a_from, "integer") .
487  " AND slot_begin < " . $ilDB->quote($a_to, "integer");
488  $res = $ilDB->query($sql);
489  return $ilDB->fetchAssoc($res);
490  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
+ Here is the caller graph for this function:

◆ getRawData()

static ilSessionStatistics::getRawData (   $a_begin,
  $a_end 
)
staticprotected

Read raw data for timespan.

Parameters
integer$a_begin
integer$a_end
Returns
array

Definition at line 198 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $res, $row, and ilSessionControl\$session_types_controlled.

199  {
200  global $DIC;
201 
202  $ilDB = $DIC['ilDB'];
203 
204  $sql = "SELECT start_time,end_time,end_context FROM usr_session_stats_raw" .
205  " WHERE start_time <= " . $ilDB->quote($a_end, "integer") .
206  " AND (end_time IS NULL OR end_time >= " . $ilDB->quote($a_begin, "integer") . ")" .
207  " AND " . $ilDB->in("type", ilSessionControl::$session_types_controlled, false, "integer") .
208  " ORDER BY start_time";
209  $res = $ilDB->query($sql);
210  $all = array();
211  while ($row = $ilDB->fetchAssoc($res)) {
212  $all[] = $row;
213  }
214  return $all;
215  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB

◆ isActive()

static ilSessionStatistics::isActive ( )
static

Is session statistics active at all?

Returns
bool

Definition at line 20 of file class.ilSessionStatistics.php.

References $DIC, and $ilSetting.

21  {
22  global $DIC;
23 
24  $ilSetting = $DIC['ilSetting'];
25 
26  return (bool) $ilSetting->get('session_statistics', 1);
27 
28  /* #13566 - includes somehow won't work this late in the request - doing it directly
29  include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
30  return ilObjUserTracking::_enabledSessionStatistics();
31  */
32  }
global $DIC
Definition: saml.php:7
global $ilSetting
Definition: privfeed.php:17

◆ updateLimitLog()

static ilSessionStatistics::updateLimitLog (   $a_new_value)
static

Log max session setting.

Parameters
int$a_new_value

Definition at line 569 of file class.ilSessionStatistics.php.

References $DIC, $ilDB, $ilSetting, $ilUser, and ilSessionControl\DEFAULT_MAX_COUNT.

Referenced by ilObjUserFolderGUI\saveGeneralSettingsObject().

570  {
571  global $DIC;
572 
573  $ilDB = $DIC['ilDB'];
574  $ilSetting = $DIC['ilSetting'];
575  $ilUser = $DIC['ilUser'];
576 
577  $new_value = (int) $a_new_value;
578  $old_value = (int) $ilSetting->get("session_max_count", ilSessionControl::DEFAULT_MAX_COUNT);
579 
580  if ($new_value != $old_value) {
581  $fields = array(
582  "tstamp" => array("timestamp", time()),
583  "maxval" => array("integer", $new_value),
584  "user_id" => array("integer", $ilUser->getId())
585  );
586  $ilDB->insert("usr_session_log", $fields);
587  }
588  }
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet ...
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
global $ilDB
+ Here is the caller graph for this function:

Field Documentation

◆ SLOT_SIZE

const ilSessionStatistics::SLOT_SIZE = 15

Definition at line 13 of file class.ilSessionStatistics.php.


The documentation for this class was generated from the following file: