ILIAS  release_7 Revision v7.30-3-g800a261c036
ilComponentInstallPluginObjective Class Reference
+ Inheritance diagram for ilComponentInstallPluginObjective:
+ Collaboration diagram for ilComponentInstallPluginObjective:

Public Member Functions

 __construct (string $plugin_name)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 @inheritDoc More...
 

Protected Member Functions

 initEnvironment (Setup\Environment $environment)
 

Protected Attributes

 $plugin_name
 

Detailed Description

Definition at line 10 of file class.ilComponentInstallPluginObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilComponentInstallPluginObjective::__construct ( string  $plugin_name)

Definition at line 17 of file class.ilComponentInstallPluginObjective.php.

References $plugin_name.

Referenced by initEnvironment().

+ Here is the caller graph for this function:

Member Function Documentation

◆ achieve()

ilComponentInstallPluginObjective::achieve ( Setup\Environment  $environment)

Definition at line 62 of file class.ilComponentInstallPluginObjective.php.

62 : Setup\Environment
63 {
64 $ORIG_DIC = $this->initEnvironment($environment);
65
66 $plugin = $GLOBALS["DIC"]["ilPluginAdmin"]->getRawPluginDataFor($this->plugin_name);
67
68 if (!is_null($plugin) && $plugin['must_install'] && $plugin['supports_cli_setup']) {
70 $plugin['component_type'],
71 $plugin['component_name'],
72 $plugin['slot_id'],
73 $plugin['name']
74 );
75
76 $pl->install();
77 }
78
79 $GLOBALS["DIC"] = $ORIG_DIC;
80
81 return $environment;
82 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)

References $GLOBALS, XapiProxy\$plugin, ilPlugin\getPluginObject(), and initEnvironment().

+ Here is the call graph for this function:

◆ getHash()

ilComponentInstallPluginObjective::getHash ( )

Definition at line 25 of file class.ilComponentInstallPluginObjective.php.

25 : string
26 {
27 return hash("sha256", self::class . $this->plugin_name);
28 }

◆ getLabel()

ilComponentInstallPluginObjective::getLabel ( )

Definition at line 33 of file class.ilComponentInstallPluginObjective.php.

33 : string
34 {
35 return "Install plugin $this->plugin_name.";
36 }

◆ getPreconditions()

ilComponentInstallPluginObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 49 of file class.ilComponentInstallPluginObjective.php.

49 : array
50 {
51 return [
53 new \ilIniFilesPopulatedObjective(),
54 new \ilDatabaseUpdatedObjective(),
55 new \ilComponentPluginAdminInitObjective()
56 ];
57 }
Read the client id of the installation from the data directory.

◆ initEnvironment()

ilComponentInstallPluginObjective::initEnvironment ( Setup\Environment  $environment)
protected

Definition at line 102 of file class.ilComponentInstallPluginObjective.php.

103 {
104 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
105 $plugin_admin = $environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN);
106 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
107 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
108
109
110 // ATTENTION: This is a total abomination. It only exists to allow various
111 // sub components of the various readers to run. This is a memento to the
112 // fact, that dependency injection is something we want. Currently, every
113 // component could just service locate the whole world via the global $DIC.
114 $DIC = $GLOBALS["DIC"];
115 $GLOBALS["DIC"] = new DI\Container();
116 $GLOBALS["DIC"]["ilDB"] = $db;
117 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
118 $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
119 $GLOBALS["DIC"]["ilLog"] = new class() extends ilLogger {
120 public function __construct()
121 {
122 }
123 public function write($m, $l = ilLogLevel::INFO)
124 {
125 }
126 public function info($msg)
127 {
128 }
129 public function warning($msg)
130 {
131 }
132 public function error($msg)
133 {
134 }
135 public function debug($msg, $a = [])
136 {
137 }
138 public function dump($msg, $a = ilLogLevel::INFO)
139 {
140 }
141 };
142 $GLOBALS["DIC"]["ilLoggerFactory"] = new class() extends ilLoggerFactory {
143 public function __construct()
144 {
145 }
146 public static function getRootLogger()
147 {
148 return $GLOBALS["DIC"]["ilLog"];
149 }
150 public static function getLogger($a)
151 {
152 return $GLOBALS["DIC"]["ilLog"];
153 }
154 };
155 $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
156 $GLOBALS["DIC"]["ilBench"] = null;
157 $GLOBALS["DIC"]["lng"] = new ilLanguage('en');
158 $GLOBALS["DIC"]["ilPluginAdmin"] = $plugin_admin;
159 $GLOBALS["DIC"]["ilCtrl"] = new ilCtrl();
160 $GLOBALS["DIC"]["ilias"] = null;
161 $GLOBALS["DIC"]["ilErr"] = null;
162 $GLOBALS["DIC"]["tree"] = null;
163 $GLOBALS["DIC"]["ilAppEventHandler"] = null;
164 $GLOBALS["DIC"]["ilSetting"] = new ilSetting();
165 $GLOBALS["DIC"]["objDefinition"] = new ilObjectDefinition();
166 $GLOBALS["DIC"]["ilUser"] = new class() extends ilObjUser {
167 public $prefs = [];
168
169 public function __construct()
170 {
171 $this->prefs["language"] = "en";
172 }
173 };
174
175 if (!defined('DEBUG')) {
176 define('DEBUG', false);
177 }
178
179 if (!defined('SYSTEM_ROLE_ID')) {
180 define('SYSTEM_ROLE_ID', '2');
181 }
182
183 if (!defined("CLIENT_ID")) {
184 define('CLIENT_ID', $client_ini->readVariable('client', 'name'));
185 }
186
187 if (!defined("ILIAS_WEB_DIR")) {
188 define('ILIAS_WEB_DIR', dirname(__DIR__, 4) . "/data/");
189 }
190
191 return $DIC;
192 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:19
error($a_errmsg)
set error message @access public
This class provides processing control methods.
language handling
Component logger with individual log levels by component id.
parses the objects.xml it handles the xml-description of all ilias objects
ILIAS Setting Class.
global $DIC
Definition: goto.php:24
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
$ini
Definition: raiseError.php:4
info()
Definition: info.php:2

References Vendor\Package\$a, $DIC, $GLOBALS, $ini, __construct(), error(), ilLogLevel\INFO, and info().

Referenced by achieve(), and isApplicable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isApplicable()

ilComponentInstallPluginObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 87 of file class.ilComponentInstallPluginObjective.php.

87 : bool
88 {
89 $ORIG_DIC = $this->initEnvironment($environment);
90
91 $plugin = $GLOBALS["DIC"]["ilPluginAdmin"]->getRawPluginDataFor($this->plugin_name);
92
93 if (is_null($plugin) || !$plugin['supports_cli_setup']) {
94 return false;
95 }
96
97 $GLOBALS["DIC"] = $ORIG_DIC;
98
99 return $plugin['must_install'];
100 }

References $GLOBALS, XapiProxy\$plugin, and initEnvironment().

+ Here is the call graph for this function:

◆ isNotable()

ilComponentInstallPluginObjective::isNotable ( )

Definition at line 41 of file class.ilComponentInstallPluginObjective.php.

41 : bool
42 {
43 return true;
44 }

Field Documentation

◆ $plugin_name

ilComponentInstallPluginObjective::$plugin_name
protected

Definition at line 15 of file class.ilComponentInstallPluginObjective.php.

Referenced by __construct().


The documentation for this class was generated from the following file: