ILIAS  release_8 Revision v8.24
ilCronEcsTaskScheduler Class Reference

Class ilCronEcsTaskScheduler. More...

+ Inheritance diagram for ilCronEcsTaskScheduler:
+ Collaboration diagram for ilCronEcsTaskScheduler:

Public Member Functions

 __construct ()
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 
- Public Member Functions inherited from ilCronJob
 setDateTimeProvider (?Closure $date_time_provider)
 
 isDue (?DateTimeImmutable $last_run, ?int $schedule_type, ?int $schedule_value, bool $is_manually_executed=false)
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule (?int $a_type, ?int $a_value)
 Update current schedule (if flexible) More...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. More...
 
 isManuallyExecutable ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 activationWasToggled (ilDBInterface $db, ilSetting $setting, bool $a_currently_active)
 Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 

Data Fields

const ID = 'ecs_task_handler'
 
const DEFAULT_SCHEDULE_VALUE = 1
 
- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 

Private Attributes

ilLogger $logger
 
ilLanguage $lng
 
ilCronJobResult $result
 

Additional Inherited Members

- Protected Attributes inherited from ilCronJob
int $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

Class ilCronEcsTaskScheduler.

Start execution of ecs tasks.

Definition at line 11 of file class.ilCronEcsTaskScheduler.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronEcsTaskScheduler::__construct ( )

Definition at line 20 of file class.ilCronEcsTaskScheduler.php.

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 }
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\lng(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilCronEcsTaskScheduler::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

Definition at line 56 of file class.ilCronEcsTaskScheduler.php.

56 : int
57 {
59 }
const SCHEDULE_TYPE_IN_HOURS
@depracated This will be replaced with an ENUM in ILIAS 9

References ilCronJob\SCHEDULE_TYPE_IN_HOURS.

◆ getDefaultScheduleValue()

ilCronEcsTaskScheduler::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

Definition at line 61 of file class.ilCronEcsTaskScheduler.php.

61 : ?int
62 {
64 }

References DEFAULT_SCHEDULE_VALUE.

◆ getDescription()

ilCronEcsTaskScheduler::getDescription ( )

Reimplemented from ilCronJob.

Definition at line 36 of file class.ilCronEcsTaskScheduler.php.

36 : string
37 {
38 return $this->lng->txt('ecs_cron_task_scheduler_info');
39 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilCronEcsTaskScheduler::getId ( )

Reimplemented from ilCronJob.

Definition at line 41 of file class.ilCronEcsTaskScheduler.php.

41 : string
42 {
43 return self::ID;
44 }

References ID.

◆ getTitle()

ilCronEcsTaskScheduler::getTitle ( )

Reimplemented from ilCronJob.

Definition at line 31 of file class.ilCronEcsTaskScheduler.php.

31 : string
32 {
33 return $this->lng->txt('ecs_cron_task_scheduler');
34 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCronEcsTaskScheduler::hasAutoActivation ( )

Is to be activated on "installation", does only work for ILIAS core cron jobs.

Reimplemented from ilCronJob.

Definition at line 46 of file class.ilCronEcsTaskScheduler.php.

46 : bool
47 {
48 return false;
49 }

◆ hasFlexibleSchedule()

ilCronEcsTaskScheduler::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

Definition at line 51 of file class.ilCronEcsTaskScheduler.php.

51 : bool
52 {
53 return true;
54 }

◆ run()

ilCronEcsTaskScheduler::run ( )

Reimplemented from ilCronJob.

Definition at line 66 of file class.ilCronEcsTaskScheduler.php.

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 }
static getInstance()
Get singleton instance.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
$server

References Vendor\Package\$e, $result, $server, ilECSTaskScheduler\_getInstanceByServerId(), ilECSServerSettings\ACTIVE_SERVER, ilECSServerSettings\getInstance(), ILIAS\Repository\logger(), ilCronJobResult\setStatus(), ilCronJobResult\STATUS_CRASHED, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilCronEcsTaskScheduler::$lng
private

Definition at line 17 of file class.ilCronEcsTaskScheduler.php.

◆ $logger

ilLogger ilCronEcsTaskScheduler::$logger
private

Definition at line 16 of file class.ilCronEcsTaskScheduler.php.

◆ $result

ilCronJobResult ilCronEcsTaskScheduler::$result
private

Definition at line 18 of file class.ilCronEcsTaskScheduler.php.

Referenced by run().

◆ DEFAULT_SCHEDULE_VALUE

const ilCronEcsTaskScheduler::DEFAULT_SCHEDULE_VALUE = 1

Definition at line 14 of file class.ilCronEcsTaskScheduler.php.

Referenced by getDefaultScheduleValue().

◆ ID

const ilCronEcsTaskScheduler::ID = 'ecs_task_handler'

Definition at line 13 of file class.ilCronEcsTaskScheduler.php.

Referenced by getId().


The documentation for this class was generated from the following file: