ILIAS  release_8 Revision v8.24
class.ilComponentDefinitionsStoredObjective.php
Go to the documentation of this file.
1<?php
19declare(strict_types=1);
20
21use ILIAS\Setup;
22use ILIAS\DI;
24
26{
31
32 public function __construct(bool $populate_before = true)
33 {
34 $this->populate_before = $populate_before;
35 }
36
40 public function getHash(): string
41 {
42 return hash("sha256", self::class);
43 }
44
48 public function getLabel(): string
49 {
50 return "Module- and Servicedefinitions are stored. Events are initialized.";
51 }
52
56 public function isNotable(): bool
57 {
58 return true;
59 }
60
64 public function getPreconditions(Setup\Environment $environment): array
65 {
66 return [
67 new \ilDatabaseUpdatedObjective(),
68 new \ilDatabaseUpdateStepsExecutedObjective(new ilCOPageDBUpdateSteps()),
69 new \ilSettingsFactoryExistsObjective(),
70 new \ilComponentRepositoryExistsObjective(),
71 new \ilComponentFactoryExistsObjective(),
72 ];
73 }
74
78 public function achieve(Setup\Environment $environment): Setup\Environment
79 {
80 $ilias_path = __DIR__ . "/../../../..";
81
82 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
83 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
84 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
86 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
88 $component_factory = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY);
90 $settings_factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
91
92 // ATTENTION: This is a total abomination. It only exists to allow various
93 // sub components of the various readers to run. This is a memento to the
94 // fact, that dependency injection is something we want. Currently, every
95 // component could just service locate the whole world via the global $DIC.
96 $DIC = $GLOBALS["DIC"];
97 $GLOBALS["DIC"] = new DI\Container();
98 $GLOBALS["DIC"]["ilDB"] = $db;
99 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
100 $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
101 $GLOBALS["DIC"]["ilBench"] = null;
102 $GLOBALS["DIC"]["ilObjDataCache"] = null;
103 $GLOBALS["DIC"]["lng"] = new class () {
104 public function loadLanguageModule(): void
105 {
106 }
107 };
108 $GLOBALS["DIC"]["ilLog"] = new class () {
109 public function write(): void
110 {
111 }
112 public function debug(): void
113 {
114 }
115 };
116 $GLOBALS["DIC"]["ilLoggerFactory"] = new class () {
117 public function getRootLogger()
118 {
119 return new class () {
120 public function write(): void
121 {
122 }
123 };
124 }
125 public function getLogger()
126 {
127 return new class () {
128 public function write(): void
129 {
130 }
131 };
132 }
133 };
134 if (!defined("ILIAS_LOG_ENABLED")) {
135 define("ILIAS_LOG_ENABLED", false);
136 }
137 if (!defined("ILIAS_ABSOLUTE_PATH")) {
138 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
139 }
140
141 $reader = new \ilComponentDefinitionReader(
148 $db,
149 $settings_factory->settingsFor(),
150 $component_repository,
151 $component_factory
152 ),
158 );
159 $reader->purge();
160 $reader->readComponentDefinitions();
161
162 $GLOBALS["DIC"] = $DIC;
163
164 return $environment;
165 }
166
170 public function isApplicable(Setup\Environment $environment): bool
171 {
172 return true;
173 }
174}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.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 objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Container.php:19
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4