ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAuthDestroyExpiredSessionsCron.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
25 {
26  protected ilLanguage $lng;
27 
28  public function __construct()
29  {
30  global $DIC;
31 
32  $this->lng = $DIC->language();
33  $this->lng->loadLanguageModule('auth');
34  }
35 
36  public function getId(): string
37  {
38  return 'auth_destroy_expired_sessions';
39  }
40 
41  public function getTitle(): string
42  {
43  return $this->lng->txt('auth_cron_destroy_expired_sessions');
44  }
45 
46  public function getDescription(): string
47  {
48  return $this->lng->txt('auth_cron_destroy_expired_sessions_desc');
49  }
50 
51  public function hasAutoActivation(): bool
52  {
53  return false;
54  }
55 
56  public function hasFlexibleSchedule(): bool
57  {
58  return true;
59  }
60 
61  public function getValidScheduleTypes(): array
62  {
63  return [
64  \ILIAS\Cron\Job\Schedule\JobScheduleType::IN_MINUTES,
65  \ILIAS\Cron\Job\Schedule\JobScheduleType::IN_HOURS
66  ];
67  }
68 
69  public function getDefaultScheduleType(): \ILIAS\Cron\Job\Schedule\JobScheduleType
70  {
71  return \ILIAS\Cron\Job\Schedule\JobScheduleType::IN_MINUTES;
72  }
73 
74  public function getDefaultScheduleValue(): ?int
75  {
76  return 1;
77  }
78 
79  public function isManuallyExecutable(): bool
80  {
81  return false;
82  }
83 
84  public function run(): JobResult
85  {
86  $result = new JobResult();
87  $result->setStatus(JobResult::STATUS_OK);
88 
89  $num_destroyed_sessions = ilSession::_destroyExpiredSessions();
91  $result->setMessage('Number of destroyed sessions: ' . $num_destroyed_sessions);
92 
93  return $result;
94  }
95 }
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:26