ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilAuthDestroyExpiredSessionsCron.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  protected ilLanguage $lng;
24 
25  public function __construct()
26  {
27  global $DIC;
28 
29  $this->lng = $DIC->language();
30  $this->lng->loadLanguageModule('auth');
31  }
32 
33  public function getId(): string
34  {
35  return 'auth_destroy_expired_sessions';
36  }
37 
38  public function getTitle(): string
39  {
40  return $this->lng->txt('auth_cron_destroy_expired_sessions');
41  }
42 
43  public function getDescription(): string
44  {
45  return $this->lng->txt('auth_cron_destroy_expired_sessions_desc');
46  }
47 
48  public function hasAutoActivation(): bool
49  {
50  return false;
51  }
52 
53  public function hasFlexibleSchedule(): bool
54  {
55  return true;
56  }
57 
58  public function getValidScheduleTypes(): array
59  {
60  return [
61  ILIAS\Cron\Schedule\CronJobScheduleType::SCHEDULE_TYPE_IN_MINUTES,
62  ILIAS\Cron\Schedule\CronJobScheduleType::SCHEDULE_TYPE_IN_HOURS
63  ];
64  }
65 
66  public function getDefaultScheduleType(): ILIAS\Cron\Schedule\CronJobScheduleType
67  {
68  return ILIAS\Cron\Schedule\CronJobScheduleType::SCHEDULE_TYPE_IN_MINUTES;
69  }
70 
71  public function getDefaultScheduleValue(): ?int
72  {
73  return 1;
74  }
75 
76  public function isManuallyExecutable(): bool
77  {
78  return false;
79  }
80 
81  public function run(): ilCronJobResult
82  {
83  $result = new ilCronJobResult();
84  $result->setStatus(ilCronJobResult::STATUS_OK);
85 
86  $num_destroyed_sessions = ilSession::_destroyExpiredSessions();
88  $result->setMessage('Number of destroyed sessions: ' . $num_destroyed_sessions);
89 
90  return $result;
91  }
92 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
static _destroyExpiredSessions()
Destroy expired sessions.
static aggretateRaw(int $a_now)
Aggregate raw session data (older than given time)
global $DIC
Definition: shib_login.php:25