ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCronEcsTaskScheduler.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12
16 public const ID = 'ecs_task_handler';
17
21 public const DEFAULT_SCHEDULE_VALUE = 1;
22
26 private $logger = null;
27
31 protected $lng = null;
32
36 protected $result = null;
37
41 public function __construct()
42 {
43 global $DIC;
44
45 $this->logger = $DIC->logger()->wsrv();
46 $this->lng = $DIC->language();
47 $this->lng->loadLanguageModule('ecs');
48
49 $this->result = new \ilCronJobResult();
50 }
51
55 public function getTitle()
56 {
57 return $this->lng->txt('ecs_cron_task_scheduler');
58 }
59
63 public function getDescription()
64 {
65 return $this->lng->txt('ecs_cron_task_scheduler_info');
66 }
67
73 public function getId()
74 {
75 return self::ID;
76 }
77
83 public function hasAutoActivation()
84 {
85 return false;
86 }
87
93 public function hasFlexibleSchedule()
94 {
95 return true;
96 }
97
103 public function getDefaultScheduleType()
104 {
106 }
107
108
109
115 public function getDefaultScheduleValue()
116 {
118 }
119
125 public function run()
126 {
127 $this->logger->debug('Starting ecs task scheduler...');
128
130
131 foreach ($servers->getServers() as $server) {
132 try {
133 $this->logger->info('Starting task execution for ecs server: ' . $server->getTitle());
134 $scheduler = \ilECSTaskScheduler::_getInstanceByServerId($server->getServerId());
135 $scheduler->startTaskExecution();
136 } catch (\Exception $e) {
137 $this->result->setStatus(\ilCronJobResult::STATUS_CRASHED);
138 $this->result->setMessage($e->getMessage());
139 $this->logger->warning('ECS task execution failed with message: ' . $e->getMessage());
140 return $this->result;
141 }
142 }
143 $this->result->setStatus(\ilCronJobResult::STATUS_OK);
144 return $this->result;
145 }
146}
An exception for terminatinating execution or to throw for unit testing.
Class ilCronEcsTaskScheduler.
__construct()
ilCronEcsTaskScheduler constructor.
getDefaultScheduleType()
Get schedule type.
getDefaultScheduleValue()
Get schedule value.
hasFlexibleSchedule()
Can the schedule be configured?
hasAutoActivation()
Is to be activated on "installation".
Cron job application base class.
const SCHEDULE_TYPE_IN_HOURS
static getInstance()
Get singleton instance.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
$server
$DIC
Definition: xapitoken.php:46