ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilSetupAgent Class Reference

Contains common objectives for the setup. More...

+ Inheritance diagram for ilSetupAgent:
+ Collaboration diagram for ilSetupAgent:

Public Member Functions

 __construct (Refinery\Factory $refinery, Data\Factory $data)
 
 hasConfig ()
 
 getArrayToConfigTransformation ()
 
 getInstallObjective (Setup\Config $config=null)
 
 getUpdateObjective (Setup\Config $config=null)
 
 getBuildArtifactObjective ()
 
 getStatusObjective (Setup\Metrics\Storage $storage)
 
 getMigrations ()
 
 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.1.0"
 
const PHP_MAX_VERSION = "8.2.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.ilSetupAgent.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ getArrayToConfigTransformation()

ilSetupAgent::getArrayToConfigTransformation ( )

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

References 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  }
Data Factory $data
+ Here is the call graph for this function:

◆ getBuildArtifactObjective()

ilSetupAgent::getBuildArtifactObjective ( )

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

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

◆ getInstallObjective()

ilSetupAgent::getInstallObjective ( Setup\Config  $config = null)

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

References getPHPMemoryLimitCondition().

79  : Setup\Objective
80  {
81  return new Setup\Objective\ObjectiveWithPreconditions(
84  new Setup\ObjectiveCollection(
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()

ilSetupAgent::getMigrations ( )

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

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

◆ getNamedObjectives()

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

Definition at line 165 of file class.ilSetupAgent.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()

ilSetupAgent::getPHPMemoryLimitCondition ( )
protected

Definition at line 98 of file class.ilSetupAgent.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()

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

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

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

◆ getUpdateObjective()

ilSetupAgent::getUpdateObjective ( Setup\Config  $config = null)

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

References $objectives.

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  }
$objectives

◆ hasConfig()

ilSetupAgent::hasConfig ( )

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

51  : bool
52  {
53  return true;
54  }

Field Documentation

◆ $data

Data Factory ilSetupAgent::$data
protected

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

Referenced by __construct().

◆ $refinery

Refinery Factory ilSetupAgent::$refinery
protected

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

Referenced by __construct().

◆ PHP_MAX_VERSION

const ilSetupAgent::PHP_MAX_VERSION = "8.2.999"
private

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

◆ PHP_MEMORY_LIMIT

const ilSetupAgent::PHP_MEMORY_LIMIT = "128M"
private

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

◆ PHP_MIN_VERSION

const ilSetupAgent::PHP_MIN_VERSION = "8.1.0"
private

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


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