ILIAS  release_7 Revision v7.30-3-g800a261c036
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 return [
48 new \ilDatabaseUpdatedObjective()
49 ];
50 }
51
55 public function achieve(Setup\Environment $environment) : Setup\Environment
56 {
57 $ilias_path = __DIR__ . "/../../../..";
58
59 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
60 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
61 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
62
63 // ATTENTION: This is a total abomination. It only exists to allow various
64 // sub components of the various readers to run. This is a memento to the
65 // fact, that dependency injection is something we want. Currently, every
66 // component could just service locate the whole world via the global $DIC.
67 $DIC = $GLOBALS["DIC"];
68 $GLOBALS["DIC"] = new DI\Container();
69 $GLOBALS["DIC"]["ilDB"] = $db;
70 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
71 $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
72 $GLOBALS["DIC"]["ilBench"] = null;
73 $GLOBALS["DIC"]["ilObjDataCache"] = null;
74 $GLOBALS["DIC"]["lng"] = new class() {
75 public function loadLanguageModule()
76 {
77 }
78 };
79 $GLOBALS["DIC"]["ilLog"] = new class() {
80 public function write()
81 {
82 }
83 public function debug()
84 {
85 }
86 };
87 $GLOBALS["DIC"]["ilLoggerFactory"] = new class() {
88 public function getRootLogger()
89 {
90 return new class() {
91 public function write()
92 {
93 }
94 };
95 }
96 public function getLogger()
97 {
98 return new class() {
99 public function write()
100 {
101 }
102 };
103 }
104 };
105 if (!defined("ILIAS_LOG_ENABLED")) {
106 define("ILIAS_LOG_ENABLED", false);
107 }
108 if (!defined("ILIAS_ABSOLUTE_PATH")) {
109 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
110 }
111
112 $mr = new \ilModuleReader("", "", "", $db);
113 $mr->clearTables();
115
116 foreach ($modules as $module) {
117 $mr = new ilModuleReader(
118 $ilias_path . "/Modules/" . $module["subdir"] . "/module.xml",
119 $module["subdir"],
120 "Modules",
121 $db
122 );
123 $mr->getModules();
124 unset($mr);
125 }
126
127 $sr = new \ilServiceReader("", "", "", $db);
128 $sr->clearTables();
130 foreach ($services as $service) {
131 $sr = new ilServiceReader(
132 $ilias_path . "/Services/" . $service["subdir"] . "/service.xml",
133 $service["subdir"],
134 "Services",
135 $db
136 );
137 $sr->getServices();
138 unset($sr);
139 }
140
141 $GLOBALS["DIC"] = $DIC;
142
143 return $environment;
144 }
145
149 public function isApplicable(Setup\Environment $environment) : bool
150 {
151 return true;
152 }
153}
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:19
Class ilModuleReader.
static getAvailableCoreModules()
Get all available core modules.
Class ilServiceReader.
static getAvailableCoreServices()
Get all available core services.
global $DIC
Definition: goto.php:24
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
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...
$ini
Definition: raiseError.php:4
$service
Definition: result.php:17