ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilCronDefinitionProcessor Class Reference
+ Inheritance diagram for ilCronDefinitionProcessor:
+ Collaboration diagram for ilCronDefinitionProcessor:

Public Member Functions

 __construct (private readonly ilDBInterface $db, ilSetting $setting, ilComponentRepository $componentRepository, ilComponentFactory $componentFactory)
 
 purge ()
 This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate. More...
 
 beginComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component starts. More...
 
 endComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component ends. More...
 
 beginTag (string $name, array $attributes)
 This is called when a tag starts in the context of the given component. More...
 
 endTag (string $name)
 This is called when a tag ends in the context of the given component. More...
 

Private Attributes

readonly ilCronJobRepository $cronRepository
 
string $component = null
 
array $has_cron
 

Detailed Description

Definition at line 23 of file class.ilCronDefinitionProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronDefinitionProcessor::__construct ( private readonly ilDBInterface  $db,
ilSetting  $setting,
ilComponentRepository  $componentRepository,
ilComponentFactory  $componentFactory 
)

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

35  {
36  $this->has_cron = [];
37 
38  $this->cronRepository = new ilCronJobRepositoryImpl(
39  $this->db,
40  $setting,
41  new NullLogger(),
42  $componentRepository,
43  $componentFactory
44  );
45  }

Member Function Documentation

◆ beginComponent()

ilCronDefinitionProcessor::beginComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component starts.

This is supposed to reset any internal parsing state.

Implements ilComponentDefinitionProcessor.

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

References $component.

51  : void
52  {
53  $this->component = $type . "/" . $component;
54  $this->has_cron = [];
55  }

◆ beginTag()

ilCronDefinitionProcessor::beginTag ( string  $name,
array  $attributes 
)

This is called when a tag starts in the context of the given component.

Parameters
string[]$attributes

Implements ilComponentDefinitionProcessor.

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

References $component.

63  : void
64  {
65  if ($name !== "cron") {
66  return;
67  }
68 
69  $component = $attributes["component"] ?? null;
70  if (!$component) {
72  }
73 
74  $this->cronRepository->registerJob(
75  $component,
76  $attributes["id"],
77  $attributes["class"],
78  ($attributes["path"] ?? null)
79  );
80 
81  $this->has_cron[] = $attributes["id"];
82  }

◆ endComponent()

ilCronDefinitionProcessor::endComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component ends.

Implements ilComponentDefinitionProcessor.

Definition at line 57 of file class.ilCronDefinitionProcessor.php.

57  : void
58  {
59  $this->component = null;
60  $this->has_cron = [];
61  }

◆ endTag()

ilCronDefinitionProcessor::endTag ( string  $name)

This is called when a tag ends in the context of the given component.

Implements ilComponentDefinitionProcessor.

Definition at line 84 of file class.ilCronDefinitionProcessor.php.

84  : void
85  {
86  if ($name !== "module" && $name !== "service") {
87  return;
88  }
89 
90  $this->cronRepository->unregisterJob($this->component, $this->has_cron);
91  }

◆ purge()

ilCronDefinitionProcessor::purge ( )

This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate.

Implements ilComponentDefinitionProcessor.

Definition at line 47 of file class.ilCronDefinitionProcessor.php.

47  : void
48  {
49  }

Field Documentation

◆ $component

string ilCronDefinitionProcessor::$component = null
private

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

Referenced by beginComponent(), and beginTag().

◆ $cronRepository

readonly ilCronJobRepository ilCronDefinitionProcessor::$cronRepository
private

Definition at line 25 of file class.ilCronDefinitionProcessor.php.

◆ $has_cron

array ilCronDefinitionProcessor::$has_cron
private

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


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