ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilComponentDefinitionsStoredObjective.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4use ILIAS\DI;
5
7{
12
13 public function __construct(bool $populate_before = true)
14 {
15 $this->populate_before = $populate_before;
16 }
17
21 public function getHash() : string
22 {
23 return hash("sha256", self::class);
24 }
25
29 public function getLabel() : string
30 {
31 return "Module- and Servicedefinitions are stored. Events are initialized.";
32 }
33
37 public function isNotable() : bool
38 {
39 return true;
40 }
41
45 public function getPreconditions(Setup\Environment $environment) : array
46 {
47 $config = $environment->getConfigFor('database');
48 return [
49 new \ilDatabaseUpdatedObjective($config, $this->populate_before)
50 ];
51 }
52
56 public function achieve(Setup\Environment $environment) : Setup\Environment
57 {
58 $ilias_path = __DIR__ . "/../../../..";
59
60 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
61 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
62 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
63
64 // ATTENTION: This is a total abomination. It only exists to allow various
65 // sub components of the various readers to run. This is a memento to the
66 // fact, that dependency injection is something we want. Currently, every
67 // component could just service locate the whole world via the global $DIC.
68 $DIC = $GLOBALS["DIC"];
69 $GLOBALS["DIC"] = new DI\Container();
70 $GLOBALS["DIC"]["ilDB"] = $db;
71 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
72 $GLOBALS["DIC"]["ilClientIniFile"] = $ini;
73 $GLOBALS["DIC"]["ilBench"] = null;
74 $GLOBALS["DIC"]["ilObjDataCache"] = null;
75 $GLOBALS["DIC"]["lng"] = new class() {
76 public function loadLanguageModule()
77 {
78 }
79 };
80 $GLOBALS["DIC"]["ilLog"] = new class() {
81 public function write()
82 {
83 }
84 public function debug()
85 {
86 }
87 };
88 $GLOBALS["DIC"]["ilLoggerFactory"] = new class() {
89 public function getRootLogger()
90 {
91 return new class() {
92 public function write()
93 {
94 }
95 };
96 }
97 public function getLogger()
98 {
99 return new class() {
100 public function write()
101 {
102 }
103 };
104 }
105 };
106 if (!defined("ILIAS_LOG_ENABLED")) {
107 define("ILIAS_LOG_ENABLED", false);
108 }
109 if (!defined("ILIAS_ABSOLUTE_PATH")) {
110 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
111 }
112
113 $mr = new \ilModuleReader("", "", "", $db);
114 $mr->clearTables();
116
117 foreach ($modules as $module) {
118 $mr = new ilModuleReader(
119 $ilias_path . "/Modules/" . $module["subdir"] . "/module.xml",
120 $module["subdir"],
121 "Modules",
122 $db
123 );
124 $mr->getModules();
125 unset($mr);
126 }
127
128 $sr = new \ilServiceReader("", "", "", $db);
129 $sr->clearTables();
131 foreach ($services as $service) {
132 $sr = new ilServiceReader(
133 $ilias_path . "/Services/" . $service["subdir"] . "/service.xml",
134 $service["subdir"],
135 "Services",
136 $db
137 );
138 $sr->getServices();
139 unset($sr);
140 }
141
142 $GLOBALS["DIC"] = $DIC;
143
144 return $environment;
145 }
146}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
Class ilModuleReader.
static getAvailableCoreModules()
Get all available core modules.
Class ilServiceReader.
static getAvailableCoreServices()
Get all available core services.
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
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:15
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
Class HTTPServicesTest.
$ini
Definition: raiseError.php:4
$service
Definition: result.php:17
$DIC
Definition: xapitoken.php:46