ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 getArrayToConfigTransformation ()
 
 getInstallObjective (?Setup\Config $config=null)
 
 getUpdateObjective (?Setup\Config $config=null)
 
 getBuildObjective ()
 
 getStatusObjective (Setup\Metrics\Storage $storage)
 
 getMigrations ()
 @inheritDoc More...
 
 getNamedObjectives (?Config $config=null)
 

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.

43 {
44 $this->refinery = $refinery;
45 $this->data = $data;
46 }

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getArrayToConfigTransformation()

ilCommonSetupAgent::getArrayToConfigTransformation ( )

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

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 }

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

+ Here is the call graph for this function:

◆ getBuildObjective()

ilCommonSetupAgent::getBuildObjective ( )

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.

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"),
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.

References getPHPMemoryLimitCondition().

+ Here is the call graph for this function:

◆ getMigrations()

ilCommonSetupAgent::getMigrations ( )

@inheritDoc

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:31

◆ getPHPMemoryLimitCondition()

ilCommonSetupAgent::getPHPMemoryLimitCondition ( )
protected

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

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:28

Referenced by getInstallObjective().

+ 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.

118 : Setup\Objective
119 {
120 $objectives = [
121 new Setup\Objective\ObjectiveWithPreconditions(
123 new Setup\Condition\PHPVersionCondition(self::PHP_MIN_VERSION, self::PHP_MAX_VERSION, true),
126 )
127 ];
128
129 if ($config !== null) {
132 }
133
134 return new Setup\ObjectiveCollection(
135 "Complete common ILIAS objectives.",
136 false,
137 ...$objectives
138 );
139 }
$objectives

References $objectives.

◆ hasConfig()

ilCommonSetupAgent::hasConfig ( )

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(), and getArrayToConfigTransformation().

◆ $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: