ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilComponentPluginAdminInitObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22use ILIAS\DI;
23
25{
29 public function getHash(): string
30 {
31 return hash("sha256", self::class);
32 }
33
37 public function getLabel(): string
38 {
39 return "ilPluginAdmin is initialized and stored into the environment.";
40 }
41
45 public function isNotable(): bool
46 {
47 return true;
48 }
49
53 public function getPreconditions(Setup\Environment $environment): array
54 {
55 return [
56 new \ilLanguagesInstalledAndUpdatedObjective(new ilSetupLanguage('en')),
58 ];
59 }
60
64 public function achieve(Setup\Environment $environment): Setup\Environment
65 {
66 // ATTENTION: This is a total abomination. It only exists to allow various
67 // sub components of the various readers to run. This is a memento to the
68 // fact, that dependency injection is something we want. Currently, every
69 // component could just service locate the whole world via the global $DIC.
70 $DIC = $GLOBALS["DIC"];
71 $GLOBALS["DIC"] = new DI\Container();
72 $GLOBALS["DIC"]["lng"] = new class () {
73 public function loadLanguageModule(): void
74 {
75 }
76 };
77
78 $environment = $environment->withResource(
79 Setup\Environment::RESOURCE_PLUGIN_ADMIN,
80 new ilPluginAdmin($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY))
81 );
82
83 $GLOBALS["DIC"] = $DIC;
84
85 return $environment;
86 }
87
91 public function isApplicable(Setup\Environment $environment): bool
92 {
93 return is_null($environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN));
94 }
95}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
isApplicable(Setup\Environment $environment)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language handling for setup
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
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...
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54