ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilComponentDefinitionsStoredObjective.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use ILIAS\Setup;
22 use ILIAS\DI;
25 
26 class ilComponentDefinitionsStoredObjective implements Setup\Objective
27 {
31  protected $populate_before;
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(
143  new \ilBadgeDefinitionProcessor($db),
144  new \ilCOPageDefinitionProcessor($db),
147  new \ILIAS\Cron\Setup\DefinitionProcessor(
148  $db,
149  $settings_factory->settingsFor(),
150  $component_repository,
151  $component_factory
152  ),
154  new ObjectDefinitionProcessor($db),
155  new \ilSystemCheckDefinitionProcessor($db),
156  new \ilSecurePathDefinitionProcessor($db),
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 }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Container.php:19
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
$ini
Definition: raiseError.php:20