ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilCronOerHarvester.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\MetaData\OERHarvester\Services\Services as PublishingServices;
27use ILIAS\MetaData\Presentation\UtilitiesInterface as PresentationUtilities;
28
34{
35 public const string CRON_JOB_IDENTIFIER = 'meta_oer_harvester';
36 protected const int DEFAULT_SCHEDULE_VALUE = 1;
37
39 private PresentationUtilities $presentation_utilities;
40 private PublishingServices $publishing_services;
41
42 public function __construct()
43 {
44 global $DIC;
45
47
48 $this->logger = $internal_services->dic()->logger()->meta();
49 $this->presentation_utilities = $internal_services->presentation()->utilities();
50 $this->publishing_services = $internal_services->OERHarvester();
51 }
52
53 public function usesLegacyForms(): bool
54 {
55 return false;
56 }
57
58 public function getTitle(): string
59 {
60 return $this->presentation_utilities->txt('meta_oer_harvester');
61 }
62
63 public function getDescription(): string
64 {
65 return $this->presentation_utilities->txt('meta_oer_harvester_desc');
66 }
67
68 public function getId(): string
69 {
71 }
72
73 public function hasAutoActivation(): bool
74 {
75 return false;
76 }
77
78 public function hasFlexibleSchedule(): bool
79 {
80 return true;
81 }
82
84 {
85 return JobScheduleType::DAILY;
86 }
87
88 public function getDefaultScheduleValue(): ?int
89 {
91 }
92
93 public function run(): JobResult
94 {
95 $this->logger->info('Started cron oer harvester.');
96 $automatic_publisher = $this->publishing_services->automaticPublisher();
97 $res = $automatic_publisher->run(new ResultWrapper(new JobResult()));
98 $this->logger->info('cron oer harvester finished');
99
100 return $res->get();
101 }
102
103 public function addToExternalSettingsForm(int $a_form_id, array &$a_fields, bool $a_is_active): void
104 {
105 switch ($a_form_id) {
107
108 $a_fields['meta_oer_harvester'] =
109 (
110 $a_is_active ?
111 $this->presentation_utilities->txt('enabled') :
112 $this->presentation_utilities->txt('disabled')
113 );
114 break;
115 }
116 }
117}
Cron job for definition for oer harvesting.
PublishingServices $publishing_services
PresentationUtilities $presentation_utilities
hasAutoActivation()
Is to be activated on "installation", does only work for ILIAS core cron jobs.
addToExternalSettingsForm(int $a_form_id, array &$a_fields, bool $a_is_active)
Component logger with individual log levels by component id.
$res
Definition: ltiservices.php:69
$internal_services
Definition: oai.php:30
global $DIC
Definition: shib_login.php:26