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

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

 $plugin_name
 

Detailed Description

Definition at line 26 of file class.ilComponentUpdatePluginObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilComponentUpdatePluginObjective::__construct ( string  $plugin_name)

Member Function Documentation

◆ achieve()

ilComponentUpdatePluginObjective::achieve ( Setup\Environment  $environment)

Definition at line 80 of file class.ilComponentUpdatePluginObjective.php.

80 : Setup\Environment
81 {
82 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
83 $component_factory = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY);
84 $info = $component_repository->getPluginByName($this->plugin_name);
85
86 if (!$info->supportsCLISetup()) {
87 throw new \RuntimeException(
88 "Plugin $this->plugin_name does not support command line setup."
89 );
90 }
91
92 if (!$info->isUpdateRequired()) {
93 throw new \RuntimeException(
94 "Plugin $this->plugin_name is already updated."
95 );
96 }
97
98 [$ORIG_DIC, $ORIG_ilDB] = $this->initEnvironment($environment, $component_repository, $component_factory);
99 $plugin = $component_factory->getPlugin($info->getId());
100 $plugin->update();
101 $GLOBALS["DIC"] = $ORIG_DIC;
102 $GLOBALS["ilDB"] = $ORIG_ilDB;
103
104 return $environment;
105 }
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()

ilComponentUpdatePluginObjective::getHash ( )

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

41 : string
42 {
43 return hash("sha256", self::class . $this->plugin_name);
44 }

◆ getLabel()

ilComponentUpdatePluginObjective::getLabel ( )

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

49 : string
50 {
51 return "Update plugin $this->plugin_name.";
52 }

◆ getPreconditions()

ilComponentUpdatePluginObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 65 of file class.ilComponentUpdatePluginObjective.php.

65 : array
66 {
67 return [
69 new \ilIniFilesLoadedObjective(),
70 new \ilDatabaseInitializedObjective(),
71 new \ilComponentPluginAdminInitObjective(),
72 new \ilComponentRepositoryExistsObjective(),
73 new \ilComponentFactoryExistsObjective()
74 ];
75 }
Read the client id of the installation from the data directory.

◆ initEnvironment()

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

Definition at line 118 of file class.ilComponentUpdatePluginObjective.php.

122 : array {
123 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
124 $plugin_admin = $environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN);
125 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
126 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
127
128 // ATTENTION: This is a total abomination. It only exists to allow various
129 // sub components of the various readers to run. This is a memento to the
130 // fact, that dependency injection is something we want. Currently, every
131 // component could just service locate the whole world via the global $DIC.
132 $ORIG_DIC = $GLOBALS["DIC"];
133 $ORIG_ilDB = $GLOBALS["ilDB"];
134
135 $GLOBALS["DIC"] = new DI\Container();
136 $GLOBALS["DIC"]["component.repository"] = $component_repository;
137 $GLOBALS["DIC"]["component.factory"] = $component_factory;
138 $GLOBALS["DIC"]["ilDB"] = $db;
139 $GLOBALS["ilDB"] = $db;
140 $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
141 $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
142 $GLOBALS["DIC"]["ilLogger"] = new NullLogger();
143 $GLOBALS["DIC"]["ilLog"] = new NullLogger();
144 $GLOBALS["DIC"]["ilLoggerFactory"] = new class () extends ilLoggerFactory {
145 public function __construct()
146 {
147 }
148 public static function getRootLogger(): ilLogger
149 {
150 return $GLOBALS["DIC"]["ilLogger"];
151 }
152 public static function getLogger(string $a_component_id): ilLogger
153 {
154 return $GLOBALS["DIC"]["ilLogger"];
155 }
156 };
157 $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
158 $GLOBALS["DIC"]["ilBench"] = null;
159 $GLOBALS["DIC"]["lng"] = new ilLanguage('en');
160 $GLOBALS["DIC"]["ilPluginAdmin"] = $plugin_admin;
161 $GLOBALS["DIC"]["ilias"] = null;
162 $GLOBALS["DIC"]["ilErr"] = null;
163 $GLOBALS["DIC"]["tree"] = new class () extends ilTree {
164 public function __construct()
165 {
166 }
167 };
168 $GLOBALS["DIC"]["ilAppEventHandler"] = new class () extends ilAppEventHandler {
169 public function __construct()
170 {
171 }
172 public function raise($a_component, $a_event, $a_parameter = ""): void
173 {
174 }
175 };
176 $GLOBALS["DIC"]["ilObjDataCache"] = new ilObjectDataCache();
177 $GLOBALS["DIC"]["ilSetting"] = new ilSetting();
178 $GLOBALS["DIC"]["rbacadmin"] = new class () extends ilRbacAdmin {
179 public function __construct()
180 {
181 }
182 };
183 $GLOBALS["DIC"]["rbacreview"] = new class () extends ilRbacReview {
184 public function __construct()
185 {
186 }
187 };
188 $GLOBALS["DIC"]["ilUser"] = new class () extends ilObjUser {
189 public array $prefs = [];
190
191 public function __construct()
192 {
193 $this->prefs["language"] = "en";
194 }
195 };
196
197 if (!defined('DEBUG')) {
198 define('DEBUG', false);
199 }
200
201 if (!defined('SYSTEM_ROLE_ID')) {
202 define('SYSTEM_ROLE_ID', '2');
203 }
204
205 if (!defined("ILIAS_ABSOLUTE_PATH")) {
206 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 6));
207 }
208
209 if (!defined("CLIENT_ID")) {
210 define('CLIENT_ID', $client_ini->readVariable('client', 'name'));
211 }
212
213 if (!defined("ILIAS_WEB_DIR")) {
214 define('ILIAS_WEB_DIR', "public/data/");
215 }
216
217 // initialise this last to make sure the environment defined here
218 // will be available for plugins, ilObjectDefinition will create
219 // plugin instances, see https://mantis.ilias.de/view.php?id=40890
220 $GLOBALS["DIC"]["objDefinition"] = new ilObjectDefinition();
221
222 return [$ORIG_DIC, $ORIG_ilDB];
223 }
Global event handler.
language handling
Component logger with individual log levels by component id.
User class.
class ilObjectDataCache
parses the objects.xml it handles the xml-description of all ilias objects
Class ilRbacAdmin Core functions for role based access control.
class ilRbacReview Contains Review functions of core Rbac.
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

Referenced by achieve().

+ Here is the caller graph for this function:

◆ isApplicable()

ilComponentUpdatePluginObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 110 of file class.ilComponentUpdatePluginObjective.php.

110 : bool
111 {
112 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
113 $plugin = $component_repository->getPluginByName($this->plugin_name);
114
115 return $plugin->isUpdateRequired();
116 }

References XapiProxy\$plugin.

◆ isNotable()

ilComponentUpdatePluginObjective::isNotable ( )

Definition at line 57 of file class.ilComponentUpdatePluginObjective.php.

57 : bool
58 {
59 return true;
60 }

Field Documentation

◆ $plugin_name

ilComponentUpdatePluginObjective::$plugin_name
protected

Definition at line 31 of file class.ilComponentUpdatePluginObjective.php.

Referenced by __construct().


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