ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLTICronOutcomeService.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
25 
33 {
34  private ilLanguage $lng;
36 
37  public function __construct()
38  {
39  global $DIC;
40  $this->lng = $DIC->language();
41  $this->lng->loadLanguageModule("lti");
42  $this->cronRepo = $DIC->cron()->repository();
43  }
44 
46  {
47  return JobScheduleType::DAILY;
48  }
49 
50  public function getDefaultScheduleValue(): ?int
51  {
52  return 1;
53  }
54 
55  public function getId(): string
56  {
57  return 'lti_outcome';
58  }
59 
60  public function hasAutoActivation(): bool
61  {
62  return false;
63  }
64 
65  public function hasFlexibleSchedule(): bool
66  {
67  return true;
68  }
69 
70  public function getTitle(): string
71  {
72  return $this->lng->txt('lti_cron_title');
73  }
74 
75  public function getDescription(): string
76  {
77  return $this->lng->txt('lti_cron_title_desc');
78  }
79 
80  public function run(): JobResult
81  {
82  $status = \ILIAS\Cron\Job\JobResult::STATUS_NO_ACTION;
83 
84  $info = $this->cronRepo->getCronJobData($this->getId());
85  $last_ts = $info['job_status_ts'] ?? false;
86  if (!$last_ts) {
87  $last_ts = time() - 24 * 3600;
88  }
89  $since = new ilDateTime($last_ts, IL_CAL_UNIX);
90 
91 
92  $result = new \ILIAS\Cron\Job\JobResult();
93  $result->setStatus($status);
95  $result->setStatus(JobResult::STATUS_OK);
96 
97  return $result;
98  }
99 }
static handleCronUpdate(ilDateTime $since)
const IL_CAL_UNIX
Description of class class.
global $DIC
Definition: shib_login.php:22