ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPrgInvalidateExpiredProgressesCronJob.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Denis Klöpfer <denis.kloepfer@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4/* Copyright (c) 2019 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
5
6declare(strict_types=1);
7
8
10{
11 const ID = 'prg_invalidate_expired_progresses';
12
17
21 protected $log;
22
26 protected $lng;
27
28 public function __construct()
29 {
30 global $DIC;
31
32 $this->user_progress_db = ilStudyProgrammeDIC::dic()['ilStudyProgrammeUserProgressDB'];
33 $this->log = $DIC['ilLog'];
34 $this->lng = $DIC['lng'];
35 $this->lng->loadLanguageModule('prg');
36 }
37
43 public function getTitle()
44 {
45 return $this->lng->txt('prg_invalidate_expired_progresses_title');
46 }
47
53 public function getDescription()
54 {
55 return $this->lng->txt('prg_invalidate_expired_progresses_desc');
56 }
57
63 public function getId()
64 {
65 return self::ID;
66 }
67
73 public function hasAutoActivation()
74 {
75 return true;
76 }
77
83 public function hasFlexibleSchedule()
84 {
85 return true;
86 }
87
93 public function getDefaultScheduleType()
94 {
96 }
97
103 public function getDefaultScheduleValue()
104 {
105 return 1;
106 }
107
113 public function run()
114 {
115 $result = new ilCronJobResult();
116 foreach ($this->user_progress_db->getExpiredSuccessfulInstances() as $progress) {
117 try {
118 $progress->invalidate();
119 } catch (ilException $e) {
120 $this->log->write('an error occured: ' . $e->getMessage());
121 }
122 }
124 return $result;
125 }
126}
$result
An exception for terminatinating execution or to throw for unit testing.
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_IN_DAYS
Base class for ILIAS Exception handling.
$DIC
Definition: xapitoken.php:46