ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilComponentDefinitionsStoredObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22use ILIAS\DI;
25
27{
32
33 public function __construct(bool $populate_before = true)
34 {
35 $this->populate_before = $populate_before;
36 }
37
41 public function getHash(): string
42 {
43 return hash("sha256", self::class);
44 }
45
49 public function getLabel(): string
50 {
51 return "Module- and Servicedefinitions are stored.";
52 }
53
57 public function isNotable(): bool
58 {
59 return true;
60 }
61
65 public function getPreconditions(Setup\Environment $environment): array
66 {
67 return [
68 new \ilDatabaseUpdatedObjective(),
69 new \ilDatabaseUpdateStepsExecutedObjective(new ilCOPageDBUpdateSteps()),
70 new \ilSettingsFactoryExistsObjective(),
71 new \ilComponentRepositoryExistsObjective(),
72 new \ilComponentFactoryExistsObjective(),
73 ];
74 }
75
79 public function achieve(Setup\Environment $environment): Setup\Environment
80 {
81 $ilias_path = __DIR__ . "/../../../..";
82
83 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
84 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
85 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
87 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
89 $component_factory = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY);
91 $settings_factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
92
93 // ATTENTION: This is a total abomination. It only exists to allow various
94 // sub components of the various readers to run. This is a memento to the
95 // fact, that dependency injection is something we want. Currently, every
96 // component could just service locate the whole world via the global $DIC.
97 $DIC = $GLOBALS["DIC"];
98 $GLOBALS["DIC"] = new DI\Container();
99 $GLOBALS["DIC"]["ilDB"] = $db;
100 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
101 $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
102 $GLOBALS["DIC"]["ilBench"] = null;
103 $GLOBALS["DIC"]["ilObjDataCache"] = null;
104 $GLOBALS["DIC"]["lng"] = new class () {
105 public function loadLanguageModule(): void
106 {
107 }
108 };
109 $GLOBALS["DIC"]["ilLog"] = new class () {
110 public function write(): void
111 {
112 }
113 public function debug(): void
114 {
115 }
116 };
117 $GLOBALS["DIC"]["ilLoggerFactory"] = new class () {
118 public function getRootLogger()
119 {
120 return new class () {
121 public function write(): void
122 {
123 }
124 };
125 }
126 public function getLogger()
127 {
128 return new class () {
129 public function write(): void
130 {
131 }
132 };
133 }
134 };
135 if (!defined("ILIAS_LOG_ENABLED")) {
136 define("ILIAS_LOG_ENABLED", false);
137 }
138 if (!defined("ILIAS_ABSOLUTE_PATH")) {
139 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 6));
140 }
141
142 $reader = new \ilComponentDefinitionReader(
147 new \ILIAS\Cron\Setup\DefinitionProcessor(
148 $db,
149 $settings_factory->settingsFor(),
150 $component_repository,
151 $component_factory
152 ),
157 );
158 $reader->purge();
159 $reader->readComponentDefinitions();
160
161 $GLOBALS["DIC"] = $DIC;
162
163 return $environment;
164 }
165
169 public function isApplicable(Setup\Environment $environment): bool
170 {
171 return true;
172 }
173}
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...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$ini
Definition: raiseError.php:20
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54