20declare(strict_types=1);
43 return hash(
"sha256", self::class . $this->plugin_name);
51 return "Update plugin $this->plugin_name.";
69 new \ilIniFilesLoadedObjective(),
70 new \ilDatabaseInitializedObjective(),
71 new \ilComponentPluginAdminInitObjective(),
72 new \ilComponentRepositoryExistsObjective(),
73 new \ilComponentFactoryExistsObjective()
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);
86 if (!$info->supportsCLISetup()) {
87 throw new \RuntimeException(
88 "Plugin $this->plugin_name does not support command line setup."
92 if (!$info->isUpdateRequired()) {
93 throw new \RuntimeException(
94 "Plugin $this->plugin_name is already updated."
98 [$ORIG_DIC, $ORIG_ilDB] = $this->
initEnvironment($environment, $component_repository, $component_factory);
99 $plugin = $component_factory->getPlugin($info->getId());
112 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
113 $plugin = $component_repository->getPluginByName($this->plugin_name);
115 return $plugin->isUpdateRequired();
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);
136 $GLOBALS[
"DIC"][
"component.repository"] = $component_repository;
137 $GLOBALS[
"DIC"][
"component.factory"] = $component_factory;
141 $GLOBALS[
"DIC"][
"ilClientIniFile"] = $client_ini;
146 public function isHandling(
int $a_level): bool
150 public function log(
string $a_message,
int $a_level =
ilLogLevel::INFO): void
156 public function debug(
string $a_message, array $a_context = array()): void
159 public function info(
string $a_message): void
162 public function notice(
string $a_message): void
165 public function warning(
string $a_message): void
168 public function error(
string $a_message): void
171 public function critical(
string $a_message): void
174 public function alert(
string $a_message): void
177 public function emergency(
string $a_message): void
183 public function writeLanguageLog(
string $a_topic,
string $a_lang_key): void
186 public function logStack(?
int $a_level =
null,
string $a_message =
''): void
189 public function writeMemoryPeakUsage(
int $a_level): void
200 public function info($msg): void
203 public function warning($msg): void
206 public function error($msg): void
209 public function debug($msg,
$a = []): void
220 public static function getRootLogger():
ilLogger
224 public static function getLogger(
string $a_component_id):
ilLogger
232 $GLOBALS[
"DIC"][
"ilPluginAdmin"] = $plugin_admin;
244 public function raise($a_component, $a_event, $a_parameter =
""):
void
261 public array $prefs = [];
265 $this->prefs[
"language"] =
"en";
269 if (!defined(
'DEBUG')) {
270 define(
'DEBUG',
false);
273 if (!defined(
'SYSTEM_ROLE_ID')) {
274 define(
'SYSTEM_ROLE_ID',
'2');
277 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
278 define(
"ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
281 if (!defined(
"CLIENT_ID")) {
282 define(
'CLIENT_ID', $client_ini->readVariable(
'client',
'name'));
285 if (!defined(
"ILIAS_WEB_DIR")) {
286 define(
'ILIAS_WEB_DIR', dirname(__DIR__, 4) .
"/data/");
294 return [$ORIG_DIC, $ORIG_ilDB];
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Customizing of pimple-DIC for ILIAS.
Read the client id of the installation from the data directory.
initEnvironment(Setup\Environment $environment, \ilComponentRepository $component_repository, \ilComponentFactory $component_factory)
isApplicable(Setup\Environment $environment)
@inheritDoc
getPreconditions(Setup\Environment $environment)
__construct(string $plugin_name)
achieve(Setup\Environment $environment)
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
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...
An environment holds resources to be used in the setup process.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.
Readable part of repository interface to ilComponentDataDB.
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...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples