ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCronEcsTaskScheduler Class Reference

Class ilCronEcsTaskScheduler. More...

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

Public Member Functions

 __construct ()
 ilCronEcsTaskScheduler constructor. More...
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $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...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Data Fields

const ID = 'ecs_task_handler'
 
const DEFAULT_SCHEDULE_VALUE = 1
 
- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Protected Attributes

 $lng = null
 
 $result = null
 

Private Attributes

 $logger = null
 

Additional Inherited Members

- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Detailed Description

Class ilCronEcsTaskScheduler.

Start execution of ecs tasks.

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

Constructor & Destructor Documentation

◆ __construct()

ilCronEcsTaskScheduler::__construct ( )

ilCronEcsTaskScheduler constructor.

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

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

References $DIC.

Member Function Documentation

◆ getDefaultScheduleType()

ilCronEcsTaskScheduler::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

104 {
106 }
const SCHEDULE_TYPE_IN_HOURS

References ilCronJob\SCHEDULE_TYPE_IN_HOURS.

◆ getDefaultScheduleValue()

ilCronEcsTaskScheduler::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

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

References DEFAULT_SCHEDULE_VALUE.

◆ getDescription()

ilCronEcsTaskScheduler::getDescription ( )
Returns
string

Reimplemented from ilCronJob.

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

64 {
65 return $this->lng->txt('ecs_cron_task_scheduler_info');
66 }

◆ getId()

ilCronEcsTaskScheduler::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

References ID.

◆ getTitle()

ilCronEcsTaskScheduler::getTitle ( )
Returns
string

Reimplemented from ilCronJob.

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

56 {
57 return $this->lng->txt('ecs_cron_task_scheduler');
58 }

◆ hasAutoActivation()

ilCronEcsTaskScheduler::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

84 {
85 return false;
86 }

◆ hasFlexibleSchedule()

ilCronEcsTaskScheduler::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

94 {
95 return true;
96 }

◆ run()

ilCronEcsTaskScheduler::run ( )

Run job.

Returns
\ilCronJobResult

Reimplemented from ilCronJob.

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

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 }
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\getInstance(), ilCronJobResult\STATUS_CRASHED, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilCronEcsTaskScheduler::$lng = null
protected

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

◆ $logger

ilCronEcsTaskScheduler::$logger = null
private

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

◆ $result

ilCronEcsTaskScheduler::$result = null
protected

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

Referenced by run().

◆ DEFAULT_SCHEDULE_VALUE

const ilCronEcsTaskScheduler::DEFAULT_SCHEDULE_VALUE = 1

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

Referenced by getDefaultScheduleValue().

◆ ID

const ilCronEcsTaskScheduler::ID = 'ecs_task_handler'

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

Referenced by getId().


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