ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ILIAS\Cron\CronJob
 setDateTimeProvider (?\Closure $date_time_provider)
 
 isDue (?\DateTimeImmutable $last_run, ?JobScheduleType $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 (?JobScheduleType $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 ()
 
 usesLegacyForms ()
 
 getCustomConfigurationInput (\ILIAS\UI\Factory $ui_factory, \ILIAS\Refinery\Factory $factory, \ilLanguage $lng)
 
 addCustomSettingsToForm (\ilPropertyFormGUI $a_form)
 
 saveCustomConfiguration (mixed $form_data)
 
 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
 

Private Attributes

ilLogger $logger
 
ilLanguage $lng
 
JobResult $result
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\Cron\CronJob
JobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

Class ilCronEcsTaskScheduler.

Start execution of ecs tasks.

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

Constructor & Destructor Documentation

◆ __construct()

ilCronEcsTaskScheduler::__construct ( )

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

38 {
39 global $DIC;
40
41 $this->logger = $DIC->logger()->wsrv();
42 $this->lng = $DIC->language();
43 $this->lng->loadLanguageModule('ecs');
44
45 $this->result = new \ILIAS\Cron\Job\JobResult();
46 }
global $DIC
Definition: shib_login.php:26

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 ILIAS\Cron\CronJob.

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

74 {
75 return JobScheduleType::IN_HOURS;
76 }

◆ getDefaultScheduleValue()

ilCronEcsTaskScheduler::getDefaultScheduleValue ( )

Reimplemented from ILIAS\Cron\CronJob.

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

78 : ?int
79 {
81 }

References DEFAULT_SCHEDULE_VALUE.

◆ getDescription()

ilCronEcsTaskScheduler::getDescription ( )

Reimplemented from ILIAS\Cron\CronJob.

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

53 : string
54 {
55 return $this->lng->txt('ecs_cron_task_scheduler_info');
56 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilCronEcsTaskScheduler::getId ( )

Reimplemented from ILIAS\Cron\CronJob.

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

58 : string
59 {
60 return self::ID;
61 }

References ID.

◆ getTitle()

ilCronEcsTaskScheduler::getTitle ( )

Reimplemented from ILIAS\Cron\CronJob.

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

48 : string
49 {
50 return $this->lng->txt('ecs_cron_task_scheduler');
51 }

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 ILIAS\Cron\CronJob.

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

63 : bool
64 {
65 return false;
66 }

◆ hasFlexibleSchedule()

ilCronEcsTaskScheduler::hasFlexibleSchedule ( )

Reimplemented from ILIAS\Cron\CronJob.

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

68 : bool
69 {
70 return true;
71 }

◆ run()

ilCronEcsTaskScheduler::run ( )

Reimplemented from ILIAS\Cron\CronJob.

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

83 : JobResult
84 {
85 $this->logger->debug('Starting ecs task scheduler...');
86
88
89 foreach ($servers->getServers(ilECSServerSettings::ACTIVE_SERVER) as $server) {
90 try {
91 $this->logger->info('Starting task execution for ecs server: ' . $server->getTitle());
92 $scheduler = \ilECSTaskScheduler::_getInstanceByServerId($server->getServerId());
93 $scheduler->startTaskExecution();
94 } catch (Exception $e) {
95 $this->result->setStatus(\ILIAS\Cron\Job\JobResult::STATUS_CRASHED);
96 $this->result->setMessage(
97 mb_substr(sprintf('Exc.: %s / %s', $e->getMessage(), $e->getTraceAsString()), 0, 400)
98 );
99 $this->logger->error('ECS task execution failed with message: ' . $e->getMessage());
100 $this->logger->error($e->getTraceAsString());
101 return $this->result;
102 }
103 }
104 $this->result->setStatus(\ILIAS\Cron\Job\JobResult::STATUS_OK);
105 return $this->result;
106 }
setStatus(int $a_value)
Definition: JobResult.php:58
static getInstance()
Get singleton instance.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$server
Definition: shib_login.php:28

References Vendor\Package\$e, $result, $server, ilECSTaskScheduler\_getInstanceByServerId(), ilECSServerSettings\ACTIVE_SERVER, ilECSServerSettings\getInstance(), ILIAS\Repository\logger(), and ILIAS\Cron\Job\JobResult\setStatus().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilCronEcsTaskScheduler::$lng
private

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

◆ $logger

ilLogger ilCronEcsTaskScheduler::$logger
private

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

◆ $result

JobResult ilCronEcsTaskScheduler::$result
private

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

Referenced by run().

◆ DEFAULT_SCHEDULE_VALUE

const ilCronEcsTaskScheduler::DEFAULT_SCHEDULE_VALUE = 1

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

Referenced by getDefaultScheduleValue().

◆ ID

const ilCronEcsTaskScheduler::ID = 'ecs_task_handler'

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

Referenced by getId().


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