ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilComponentPluginAdminInitObjective.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4use ILIAS\DI;
5
7{
11 public function getHash() : string
12 {
13 return hash("sha256", self::class);
14 }
15
19 public function getLabel() : string
20 {
21 return "ilPluginAdmin is initialized and stored into the environment.";
22 }
23
27 public function isNotable() : bool
28 {
29 return true;
30 }
31
35 public function getPreconditions(Setup\Environment $environment) : array
36 {
37 if (!$environment->hasConfigFor('language')) {
38 return [];
39 }
40
41 $config = $environment->getConfigFor('language');
42 return [
43 new \ilLanguagesInstalledAndUpdatedObjective($config, new ilSetupLanguage('en'))
44 ];
45 }
46
50 public function achieve(Setup\Environment $environment) : Setup\Environment
51 {
52 // ATTENTION: This is a total abomination. It only exists to allow various
53 // sub components of the various readers to run. This is a memento to the
54 // fact, that dependency injection is something we want. Currently, every
55 // component could just service locate the whole world via the global $DIC.
56 $DIC = $GLOBALS["DIC"];
57 $GLOBALS["DIC"] = new DI\Container();
58 $GLOBALS["DIC"]["lng"] = new class() {
59 public function loadLanguageModule()
60 {
61 }
62 };
63
64 $environment = $environment->withResource(
65 Setup\Environment::RESOURCE_PLUGIN_ADMIN,
66 new ilPluginAdmin()
67 );
68
69 $GLOBALS["DIC"] = $DIC;
70
71 return $environment;
72 }
73
77 public function isApplicable(Setup\Environment $environment) : bool
78 {
79 return is_null($environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN));
80 }
81}
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
isApplicable(Setup\Environment $environment)
@inheritDoc
Administration class for plugins.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: goto.php:24
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
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...