ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 

Protected Member Functions

 initEnvironment (Setup\Environment $environment)
 

Protected Attributes

 $plugin_name
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilComponentActivatePluginsObjective::__construct ( string  $plugin_name)

Definition at line 16 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 58 of file class.ilComponentActivatePluginsObjective.php.

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

58  : Setup\Environment
59  {
60  $ORIG_DIC = $this->initEnvironment($environment);
61 
62  $plugin = $GLOBALS["DIC"]["ilPluginAdmin"]->getRawPluginDataFor($this->plugin_name);
63 
64  if (!is_null($plugin) && $plugin['activation_possible'] && $plugin['supports_cli_setup']) {
66  $plugin['component_type'],
67  $plugin['component_name'],
68  $plugin['slot_id'],
69  $plugin['name']
70  );
71 
72  $pl->activate();
73  }
74 
75  $GLOBALS["DIC"] = $ORIG_DIC;
76 
77  return $environment;
78  }
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ getHash()

ilComponentActivatePluginsObjective::getHash ( )

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

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

◆ getLabel()

ilComponentActivatePluginsObjective::getLabel ( )

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

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

◆ getPreconditions()

ilComponentActivatePluginsObjective::getPreconditions ( Setup\Environment  $environment)

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

48  : array
49  {
50  return [
51  new \ilComponentUpdatePluginObjective($this->plugin_name)
52  ];
53  }

◆ initEnvironment()

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

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

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

Referenced by achieve(), and isApplicable().

99  {
100  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
101  $plugin_admin = $environment->getResource(Setup\Environment::RESOURCE_PLUGIN_ADMIN);
102  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
103  $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
104 
105 
106  // ATTENTION: This is a total abomination. It only exists to allow various
107  // sub components of the various readers to run. This is a memento to the
108  // fact, that dependency injection is something we want. Currently, every
109  // component could just service locate the whole world via the global $DIC.
110  $DIC = $GLOBALS["DIC"];
111  $GLOBALS["DIC"] = new DI\Container();
112  $GLOBALS["DIC"]["ilDB"] = $db;
113  $GLOBALS["DIC"]["ilIliasIniFile"] = $ini;
114  $GLOBALS["DIC"]["ilClientIniFile"] = $client_ini;
115  $GLOBALS["DIC"]["ilLog"] = new class() extends ilLogger {
116  public function __construct()
117  {
118  }
119  public function write($m, $l = ilLogLevel::INFO)
120  {
121  }
122  public function info($msg)
123  {
124  }
125  public function warning($msg)
126  {
127  }
128  public function error($msg)
129  {
130  }
131  public function debug($msg, $a = [])
132  {
133  }
134  public function dump($msg, $a = ilLogLevel::INFO)
135  {
136  }
137  };
138  $GLOBALS["DIC"]["ilLoggerFactory"] = new class() extends ilLoggerFactory {
139  public function __construct()
140  {
141  }
142  public static function getRootLogger()
143  {
144  return $GLOBALS["DIC"]["ilLog"];
145  }
146  public static function getLogger($a)
147  {
148  return $GLOBALS["DIC"]["ilLog"];
149  }
150  };
151  $GLOBALS["DIC"]["ilBench"] = null;
152  $GLOBALS["DIC"]["lng"] = new ilLanguage('en');
153  $GLOBALS["DIC"]["ilPluginAdmin"] = $plugin_admin;
154  $GLOBALS["DIC"]["ilCtrl"] = new ilCtrl();
155  $GLOBALS["DIC"]["ilias"] = null;
156  $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
157  $GLOBALS["DIC"]["ilErr"] = null;
158  $GLOBALS["DIC"]["tree"] = new class() extends ilTree {
159  public function __construct()
160  {
161  }
162  };
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  }
This class provides processing control methods.
parses the objects.xml it handles the xml-description of all ilias objects
Logging factory.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
info()
Definition: info.php:2
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
Component logger with individual log levels by component id.
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isApplicable()

ilComponentActivatePluginsObjective::isApplicable ( Setup\Environment  $environment)

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

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

83  : bool
84  {
85  $ORIG_DIC = $this->initEnvironment($environment);
86 
87  $plugin = $GLOBALS["DIC"]["ilPluginAdmin"]->getRawPluginDataFor($this->plugin_name);
88 
89  if (is_null($plugin) || !$plugin['supports_cli_setup']) {
90  return false;
91  }
92 
93  $GLOBALS["DIC"] = $ORIG_DIC;
94 
95  return $plugin['activation_possible'];
96  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ isNotable()

ilComponentActivatePluginsObjective::isNotable ( )

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

40  : bool
41  {
42  return true;
43  }

Field Documentation

◆ $plugin_name

ilComponentActivatePluginsObjective::$plugin_name
protected

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

Referenced by __construct().


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