ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilComponentActivatePluginsObjective Class Reference
+ Inheritance diagram for ilComponentActivatePluginsObjective:
+ Collaboration diagram for ilComponentActivatePluginsObjective:

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, \ilComponentRepository $component_repository, \ilComponentFactory $component_factory)
 

Protected Attributes

string $plugin_name
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilComponentActivatePluginsObjective::__construct ( string  $plugin_name)

Definition at line 29 of file class.ilComponentActivatePluginsObjective.php.

References $plugin_name.

Referenced by initEnvironment().

+ Here is the caller graph for this function:

Member Function Documentation

◆ achieve()

ilComponentActivatePluginsObjective::achieve ( Setup\Environment  $environment)

Definition at line 75 of file class.ilComponentActivatePluginsObjective.php.

75 : Setup\Environment
76 {
77 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
78 $component_factory = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY);
79 $info = $component_repository->getPluginByName($this->plugin_name);
80
81 if (!$info->supportsCLISetup()) {
82 throw new \RuntimeException(
83 "Plugin $this->plugin_name does not support command line setup."
84 );
85 }
86
87 if (!$info->isActivationPossible()) {
88 throw new \RuntimeException(
89 "Plugin $this->plugin_name can not be activated."
90 );
91 }
92
93 $ORIG_DIC = $this->initEnvironment($environment, $component_repository, $component_factory);
94 $plugin = $component_factory->getPlugin($info->getId());
95 $plugin->activate();
96 $GLOBALS["DIC"] = $ORIG_DIC;
97
98 return $environment;
99 }
initEnvironment(Setup\Environment $environment, \ilComponentRepository $component_repository, \ilComponentFactory $component_factory)
$info
Definition: entry_point.php:21
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, $info, XapiProxy\$plugin, ILIAS\Setup\Environment\getResource(), and initEnvironment().

+ Here is the call graph for this function:

◆ getHash()

ilComponentActivatePluginsObjective::getHash ( )

Definition at line 37 of file class.ilComponentActivatePluginsObjective.php.

37 : string
38 {
39 return hash("sha256", self::class . $this->plugin_name);
40 }

◆ getLabel()

ilComponentActivatePluginsObjective::getLabel ( )

Definition at line 45 of file class.ilComponentActivatePluginsObjective.php.

45 : string
46 {
47 return "Activate plugin $this->plugin_name.";
48 }

◆ getPreconditions()

ilComponentActivatePluginsObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 61 of file class.ilComponentActivatePluginsObjective.php.

61 : array
62 {
63 return [
64 new \ilIniFilesLoadedObjective(),
65 new \ilDatabaseInitializedObjective(),
66 new \ilComponentPluginAdminInitObjective(),
67 new \ilComponentRepositoryExistsObjective(),
68 new \ilComponentFactoryExistsObjective()
69 ];
70 }

◆ initEnvironment()

ilComponentActivatePluginsObjective::initEnvironment ( Setup\Environment  $environment,
\ilComponentRepository  $component_repository,
\ilComponentFactory  $component_factory 
)
protected

Definition at line 112 of file class.ilComponentActivatePluginsObjective.php.

116 {
117 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
118 $plugin_admin = $environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN);
119 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
120 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
121
122 // ATTENTION: This is a total abomination. It only exists to allow various
123 // sub components of the various readers to run. This is a memento to the
124 // fact, that dependency injection is something we want. Currently, every
125 // component could just service locate the whole world via the global $DIC.
126 $DIC = $GLOBALS["DIC"];
127 $GLOBALS["DIC"] = new DI\Container();
128 $GLOBALS["DIC"]["component.repository"] = $component_repository;
129 $GLOBALS["DIC"]["component.factory"] = $component_factory;
130 $GLOBALS["DIC"]["ilDB"] = $db;
131 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
132 $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
133 $GLOBALS["DIC"]["ilLog"] = new NullLogger();
134 $GLOBALS["DIC"]["ilLoggerFactory"] = new class () extends ilLoggerFactory {
135 public function __construct()
136 {
137 }
138 public static function getRootLogger(): ilLogger
139 {
140 return $GLOBALS["DIC"]["ilLog"];
141 }
142 public static function getLogger(string $a_component_id): ilLogger
143 {
144 return $GLOBALS["DIC"]["ilLog"];
145 }
146 };
147 $GLOBALS["DIC"]["ilBench"] = null;
148 $GLOBALS["DIC"]["lng"] = new ilLanguage('en');
149 $GLOBALS["DIC"]["ilPluginAdmin"] = $plugin_admin;
150 $GLOBALS["DIC"]["ilias"] = null;
151 $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
152 $GLOBALS["DIC"]["ilErr"] = null;
153 $GLOBALS["DIC"]["tree"] = new class () extends ilTree {
154 public function __construct()
155 {
156 }
157 };
158 $GLOBALS["DIC"]["ilAppEventHandler"] = null;
159 $GLOBALS["DIC"]["ilSetting"] = new ilSetting();
160 $GLOBALS["DIC"]["ilUser"] = new class () extends ilObjUser {
161 public array $prefs = [];
162
163 public function __construct()
164 {
165 $this->prefs["language"] = "en";
166 }
167 };
168
169 if (!defined('SYSTEM_ROLE_ID')) {
170 define('SYSTEM_ROLE_ID', '2');
171 }
172
173 if (!defined("ILIAS_ABSOLUTE_PATH")) {
174 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
175 }
176
177 if (!defined("CLIENT_ID")) {
178 define('CLIENT_ID', $client_ini->readVariable('client', 'name'));
179 }
180
181 if (!defined("ILIAS_WEB_DIR")) {
182 define('ILIAS_WEB_DIR', "public/data/");
183 }
184
185 // initialise this last to make sure the environment defined here
186 // will be available for plugins, ilObjectDefinition will create
187 // plugin instances, see https://mantis.ilias.de/view.php?id=40890
188 $GLOBALS["DIC"]["objDefinition"] = new ilObjectDefinition();
189
190 return $DIC;
191 }
language handling
Component logger with individual log levels by component id.
User class.
parses the objects.xml it handles the xml-description of all ilias objects
ILIAS Setting Class.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$ini
Definition: raiseError.php:20
global $DIC
Definition: shib_login.php:26

References $DIC, $GLOBALS, $ini, and __construct().

Referenced by achieve().

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

◆ isApplicable()

ilComponentActivatePluginsObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 104 of file class.ilComponentActivatePluginsObjective.php.

104 : bool
105 {
106 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
107 $plugin = $component_repository->getPluginByName($this->plugin_name);
108
109 return $plugin->isActivationPossible($environment);
110 }

References XapiProxy\$plugin.

◆ isNotable()

ilComponentActivatePluginsObjective::isNotable ( )

Definition at line 53 of file class.ilComponentActivatePluginsObjective.php.

53 : bool
54 {
55 return true;
56 }

Field Documentation

◆ $plugin_name

string ilComponentActivatePluginsObjective::$plugin_name
protected

Definition at line 27 of file class.ilComponentActivatePluginsObjective.php.

Referenced by __construct().


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