ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilEventHandlingBuildEventInfoObjective.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Setup;
20
22{
23 public function getArtifactName(): string
24 {
25 return "event_handling_data";
26 }
27
28
30
31 public function getPreconditions(Setup\Environment $environment): array
32 {
33 return [
35 ];
36 }
37
38 public function achieve(Setup\Environment $environment): Setup\Environment
39 {
40 $this->component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
41
42 return parent::achieve($environment);
43 }
44
45 public function build(): Setup\Artifact
46 {
47 $processor = new \ilEventHandlingDefinitionProcessor();
48
49 // Plugins behave slightly differently from core components: they do not always have a plugin.xml and the
50 // `ilComponentDefinitionReader` does not read them at all. Therefore, we overwrite the reader at this point
51 // and supplement it with the information from the existing plugins.
52
53 $plugin_and_components_reader = new class ($this->component_repository, $processor) extends
55 public function __construct(
58 ) {
59 parent::__construct(...$processor);
60 }
61
62 protected function getComponents(): \Iterator
63 {
64 yield from parent::getComponents();
65
66 foreach ($this->component_repository->getPlugins() as $plugin) {
67 $xml_plugin_path = $plugin->getPath() . '/plugin.xml';
68 if (!file_exists($xml_plugin_path)) {
69 continue;
70 }
71 yield [
72 'Plugins', // Plugins are generally handled in ilAppEventHandler with the prefix "Plugins".
73 $plugin->getName(),
74 $xml_plugin_path,
75 ];
76 }
77 }
78 };
79
80 $plugin_and_components_reader->purge();
81 $plugin_and_components_reader->readComponentDefinitions();
82
83 return new Setup\Artifact\ArrayArtifact($processor->getData());
84 }
85}
An array as an artifact.
An artifact is some file that is build on demand per installation and is not shipped with the ILIAS s...
Definition: Artifact.php:28
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i....
Readable part of repository interface to ilComponentDataDB.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...