ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCronEcsTaskScheduler Class Reference

Class ilCronEcsTaskScheduler. More...

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

Public Member Functions

 __construct ()
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 
 hasAutoActivation ()
 
 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.

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

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:22
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilCronEcsTaskScheduler::getDefaultScheduleType ( )

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

74  {
75  return JobScheduleType::IN_HOURS;
76  }

◆ getDefaultScheduleValue()

ilCronEcsTaskScheduler::getDefaultScheduleValue ( )

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

78  : ?int
79  {
80  return self::DEFAULT_SCHEDULE_VALUE;
81  }

◆ getDescription()

ilCronEcsTaskScheduler::getDescription ( )

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

References ILIAS\Repository\lng().

53  : string
54  {
55  return $this->lng->txt('ecs_cron_task_scheduler_info');
56  }
+ Here is the call graph for this function:

◆ getId()

ilCronEcsTaskScheduler::getId ( )

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

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

◆ getTitle()

ilCronEcsTaskScheduler::getTitle ( )

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

References ILIAS\Repository\lng().

48  : string
49  {
50  return $this->lng->txt('ecs_cron_task_scheduler');
51  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCronEcsTaskScheduler::hasAutoActivation ( )

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

63  : bool
64  {
65  return false;
66  }

◆ hasFlexibleSchedule()

ilCronEcsTaskScheduler::hasFlexibleSchedule ( )

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

68  : bool
69  {
70  return true;
71  }

◆ run()

ilCronEcsTaskScheduler::run ( )

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

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

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  }
Interface Observer Contains several chained tasks and infos about them.
static getInstance()
Get singleton instance.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
$server
Definition: shib_login.php:24
+ 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.

◆ ID

const ilCronEcsTaskScheduler::ID = 'ecs_task_handler'

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


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