ILIAS  release_8 Revision v8.24
class.ilCronEcsTaskScheduler.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13 public const ID = 'ecs_task_handler';
14 public const DEFAULT_SCHEDULE_VALUE = 1;
15
19
20 public function __construct()
21 {
22 global $DIC;
23
24 $this->logger = $DIC->logger()->wsrv();
25 $this->lng = $DIC->language();
26 $this->lng->loadLanguageModule('ecs');
27
28 $this->result = new \ilCronJobResult();
29 }
30
31 public function getTitle(): string
32 {
33 return $this->lng->txt('ecs_cron_task_scheduler');
34 }
35
36 public function getDescription(): string
37 {
38 return $this->lng->txt('ecs_cron_task_scheduler_info');
39 }
40
41 public function getId(): string
42 {
43 return self::ID;
44 }
45
46 public function hasAutoActivation(): bool
47 {
48 return false;
49 }
50
51 public function hasFlexibleSchedule(): bool
52 {
53 return true;
54 }
55
56 public function getDefaultScheduleType(): int
57 {
59 }
60
61 public function getDefaultScheduleValue(): ?int
62 {
64 }
65
66 public function run(): ilCronJobResult
67 {
68 $this->logger->debug('Starting ecs task scheduler...');
69
71
72 foreach ($servers->getServers(ilECSServerSettings::ACTIVE_SERVER) as $server) {
73 try {
74 $this->logger->info('Starting task execution for ecs server: ' . $server->getTitle());
75 $scheduler = \ilECSTaskScheduler::_getInstanceByServerId($server->getServerId());
76 $scheduler->startTaskExecution();
77 } catch (\Exception $e) {
78 $this->result->setStatus(\ilCronJobResult::STATUS_CRASHED);
79 $this->result->setMessage($e->getMessage());
80 $this->logger->warning('ECS task execution failed with message: ' . $e->getMessage());
81 return $this->result;
82 }
83 }
85 return $this->result;
86 }
87}
Class ilCronEcsTaskScheduler.
hasAutoActivation()
Is to be activated on "installation", does only work for ILIAS core cron jobs.
const SCHEDULE_TYPE_IN_HOURS
@depracated This will be replaced with an ENUM in ILIAS 9
static getInstance()
Get singleton instance.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
language handling
Component logger with individual log levels by component id.
$server
global $DIC
Definition: feed.php:28