ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ilCommonSetupAgent Class Reference

Contains common objectives for the setup. More...

+ Inheritance diagram for ilCommonSetupAgent:
+ Collaboration diagram for ilCommonSetupAgent:

Public Member Functions

 __construct (Refinery\Factory $refinery, Data\Factory $data)
 
 hasConfig ()
 Does this agent require a configuration? More...
 
 getArrayToConfigTransformation ()
 Agents must be able to tell how to create a configuration from a nested array.
Exceptions
LogicExceptionif Agent has no Config
More...
 
 getInstallObjective (?Setup\Config $config=null)
 
 getUpdateObjective (?Setup\Config $config=null)
 
 getBuildObjective ()
 Get the goal the agent wants to achieve to build artifacts.
Exceptions
InvalidArgumentExceptionif Config does not match the Agent.
More...
 
 getStatusObjective (Setup\Metrics\Storage $storage)
 
 getMigrations ()
 
 getNamedObjectives (?Config $config=null)
 
- Public Member Functions inherited from ILIAS\Setup\Agent
 getInstallObjective (?Config $config=null)
 Get the goals the agent wants to achieve on setup. More...
 
 getUpdateObjective (?Config $config=null)
 Get the goal the agent wants to achieve on update. More...
 
 getStatusObjective (Metrics\Storage $storage)
 Get the objective to be achieved when status is requested. More...
 
 getNamedObjectives (?Config $config=null)
 Gets all named objectives The keys of the returned array are the commands. More...
 

Protected Member Functions

 getPHPMemoryLimitCondition ()
 

Protected Attributes

Refinery Factory $refinery
 
Data Factory $data
 

Private Attributes

const PHP_MEMORY_LIMIT = "128M"
 
const PHP_MIN_VERSION = "8.3.0"
 
const PHP_MAX_VERSION = "8.4.999"
 

Detailed Description

Contains common objectives for the setup.

Do not make additions here, in general all this stuff here is supposed to go elsewhere once we find out which service it really belongs to.

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

Constructor & Destructor Documentation

◆ __construct()

ilCommonSetupAgent::__construct ( Refinery\Factory  $refinery,
Data\Factory  $data 
)

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

References $data, $refinery, and ILIAS\Repository\refinery().

43  {
44  $this->refinery = $refinery;
45  $this->data = $data;
46  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getArrayToConfigTransformation()

ilCommonSetupAgent::getArrayToConfigTransformation ( )

Agents must be able to tell how to create a configuration from a nested array.

Exceptions
LogicExceptionif Agent has no Config

Implements ILIAS\Setup\Agent.

Definition at line 59 of file class.ilCommonSetupAgent.php.

References null, and ILIAS\Repository\refinery().

59  : Refinery\Transformation
60  {
61  return $this->refinery->custom()->transformation(function ($data) {
62  $export_hooks_path = null;
63  if (key_exists("export_hooks_path", $data)) {
64  $export_hooks_path = $data["export_hooks_path"];
65  }
66  $datetimezone = $this->refinery->to()->toNew(\DateTimeZone::class);
67  return new \ilSetupConfig(
68  $this->data->clientId($data["client_id"] ?? ''),
69  $datetimezone->transform([$data["server_timezone"] ?? "UTC"]),
70  $data["register_nic"] ?? false,
71  $export_hooks_path
72  );
73  });
74  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getBuildObjective()

ilCommonSetupAgent::getBuildObjective ( )

Get the goal the agent wants to achieve to build artifacts.

Exceptions
InvalidArgumentExceptionif Config does not match the Agent.

Implements ILIAS\Setup\Agent.

Definition at line 144 of file class.ilCommonSetupAgent.php.

144  : Setup\Objective
145  {
146  return new Setup\Objective\NullObjective();
147  }

◆ getInstallObjective()

ilCommonSetupAgent::getInstallObjective ( ?Setup\Config  $config = null)

Definition at line 79 of file class.ilCommonSetupAgent.php.

References getPHPMemoryLimitCondition().

79  : Setup\Objective
80  {
81  return new Setup\Objective\ObjectiveWithPreconditions(
85  "Complete common ILIAS objectives.",
86  false,
87  new Setup\Condition\PHPVersionCondition(self::PHP_MIN_VERSION, self::PHP_MAX_VERSION, true),
88  new Setup\Condition\PHPExtensionLoadedCondition("dom"),
89  new Setup\Condition\PHPExtensionLoadedCondition("xsl"),
90  new Setup\Condition\PHPExtensionLoadedCondition("gd"),
92  new ilSetupConfigStoredObjective($config),
93  new ilNICKeyRegisteredObjective($config)
94  )
95  );
96  }
A objective collection is a objective that is achieved once all subobjectives are achieved...
There seems to already exist an ILIAS installation, an interaction with it should be confirmed...
+ Here is the call graph for this function:

◆ getMigrations()

ilCommonSetupAgent::getMigrations ( )

Implements ILIAS\Setup\Agent.

Definition at line 160 of file class.ilCommonSetupAgent.php.

160  : array
161  {
162  return [];
163  }

◆ getNamedObjectives()

ilCommonSetupAgent::getNamedObjectives ( ?Config  $config = null)

Definition at line 165 of file class.ilCommonSetupAgent.php.

165  : array
166  {
167  return [
168  "registerNICKey" => new Setup\ObjectiveConstructor(
169  "Register NIC key",
170  static function () use ($config): Setup\Objective {
171  if (is_null($config)) {
172  throw new \RuntimeException(
173  "Missing Config for objective 'registerNICKey'."
174  );
175  }
176 
177  return new ilNICKeyRegisteredObjective($config);
178  }
179  ),
180  "buildExportZip" => new Setup\ObjectiveConstructor(
181  "Build ILIAS export zip",
182  static function () use ($config): Setup\Objective {
183  if (is_null($config)) {
184  throw new \RuntimeException(
185  "Missing Config for objective 'buildExportZip'."
186  );
187  }
188  return new ilExportZipBuiltObjective($config);
189  }
190  )
191  ];
192  }
An objective is a desired state of the system that is supposed to be created by the setup...
Definition: Objective.php:30

◆ getPHPMemoryLimitCondition()

ilCommonSetupAgent::getPHPMemoryLimitCondition ( )
protected

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

Referenced by getInstallObjective().

98  : Setup\Objective
99  {
100  return new Setup\Condition\ExternalConditionObjective(
101  "PHP memory limit >= " . self::PHP_MEMORY_LIMIT,
102  function (Setup\Environment $env): bool {
103  $limit = ini_get("memory_limit");
104  if ($limit == -1) {
105  return true;
106  }
107  $expected = $this->data->dataSize(self::PHP_MEMORY_LIMIT);
108  $current = $this->data->dataSize($limit);
109  return $current->inBytes() >= $expected->inBytes();
110  },
111  "To properly execute ILIAS, please take care that the PHP memory limit is at least set to 128M."
112  );
113  }
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
+ Here is the caller graph for this function:

◆ getStatusObjective()

ilCommonSetupAgent::getStatusObjective ( Setup\Metrics\Storage  $storage)

Definition at line 152 of file class.ilCommonSetupAgent.php.

152  : Setup\Objective
153  {
154  return new ilSetupMetricsCollectedObjective($storage);
155  }

◆ getUpdateObjective()

ilCommonSetupAgent::getUpdateObjective ( ?Setup\Config  $config = null)

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

References $objectives, and null.

118  : Setup\Objective
119  {
120  $objectives = [
121  new Setup\Objective\ObjectiveWithPreconditions(
122  new ilVersionWrittenToSettingsObjective($this->data),
123  new Setup\Condition\PHPVersionCondition(self::PHP_MIN_VERSION, self::PHP_MAX_VERSION, true),
126  )
127  ];
128 
129  if ($config !== null) {
130  $objectives[] = new ilSetupConfigStoredObjective($config);
131  $objectives[] = new ilNICKeyRegisteredObjective($config);
132  }
133 
134  return new Setup\ObjectiveCollection(
135  "Complete common ILIAS objectives.",
136  false,
137  ...$objectives
138  );
139  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$objectives

◆ hasConfig()

ilCommonSetupAgent::hasConfig ( )

Does this agent require a configuration?

Implements ILIAS\Setup\Agent.

Definition at line 51 of file class.ilCommonSetupAgent.php.

51  : bool
52  {
53  return true;
54  }

Field Documentation

◆ $data

Data Factory ilCommonSetupAgent::$data
protected

Definition at line 38 of file class.ilCommonSetupAgent.php.

Referenced by __construct().

◆ $refinery

Refinery Factory ilCommonSetupAgent::$refinery
protected

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

Referenced by __construct().

◆ PHP_MAX_VERSION

const ilCommonSetupAgent::PHP_MAX_VERSION = "8.4.999"
private

Definition at line 35 of file class.ilCommonSetupAgent.php.

◆ PHP_MEMORY_LIMIT

const ilCommonSetupAgent::PHP_MEMORY_LIMIT = "128M"
private

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

◆ PHP_MIN_VERSION

const ilCommonSetupAgent::PHP_MIN_VERSION = "8.3.0"
private

Definition at line 34 of file class.ilCommonSetupAgent.php.


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