ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilComponentDefinitionsStoredObjective.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 
3 use ILIAS\Setup;
4 use ILIAS\DI;
5 
6 class ilComponentDefinitionsStoredObjective implements Setup\Objective
7 {
11  protected $populate_before;
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 }
Class ilServiceReader.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
Class HTTPServicesTest.
static getAvailableCoreServices()
Get all available core services.
$service
Definition: result.php:17
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
Definition: Environment.php:11
$DIC
Definition: xapitoken.php:46
Class ilModuleReader.
static getAvailableCoreModules()
Get all available core modules.
$ini
Definition: raiseError.php:4