ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilComponentPluginAdminInitObjective.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
21 
22 use ILIAS\Setup;
23 use ILIAS\DI;
24 
25 class ilComponentPluginAdminInitObjective implements Setup\Objective
26 {
30  public function getHash(): string
31  {
32  return hash("sha256", self::class);
33  }
34 
38  public function getLabel(): string
39  {
40  return "ilPluginAdmin is initialized and stored into the environment.";
41  }
42 
46  public function isNotable(): bool
47  {
48  return true;
49  }
50 
54  public function getPreconditions(Setup\Environment $environment): array
55  {
56  return [
57  new \ilLanguagesInstalledAndUpdatedObjective(new ilSetupLanguage('en')),
59  ];
60  }
61 
65  public function achieve(Setup\Environment $environment): Setup\Environment
66  {
67  // ATTENTION: This is a total abomination. It only exists to allow various
68  // sub components of the various readers to run. This is a memento to the
69  // fact, that dependency injection is something we want. Currently, every
70  // component could just service locate the whole world via the global $DIC.
71  $DIC = $GLOBALS["DIC"];
72  $GLOBALS["DIC"] = new DI\Container();
73  $GLOBALS["DIC"]["lng"] = new class () {
74  public function loadLanguageModule(): void
75  {
76  }
77  };
78 
79  $environment = $environment->withResource(
80  Setup\Environment::RESOURCE_PLUGIN_ADMIN,
81  new ilPluginAdmin($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY))
82  );
83 
84  $GLOBALS["DIC"] = $DIC;
85 
86  return $environment;
87  }
88 
92  public function isApplicable(Setup\Environment $environment): bool
93  {
94  return is_null($environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN));
95  }
96 }
language handling for setup
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...
$GLOBALS["DIC"]
Definition: wac.php:30
global $DIC
Definition: shib_login.php:25
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