ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSetupAgent.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
7use ILIAS\Data;
8use ILIAS\UI;
9
15class ilSetupAgent implements Setup\Agent
16{
17 const PHP_MEMORY_LIMIT = "128M";
18
22 protected $refinery;
23
27 protected $data;
28
29 public function __construct(
30 Refinery\Factory $refinery,
31 Data\Factory $data
32 ) {
33 $this->refinery = $refinery;
34 $this->data = $data;
35 }
36
40 public function hasConfig() : bool
41 {
42 return true;
43 }
44
49 {
50 return $this->refinery->custom()->transformation(function ($data) {
51 $datetimezone = $this->refinery->to()->toNew(\DateTimeZone::class);
52 return new \ilSetupConfig(
53 $this->data->clientId($data["client_id"] ?? ''),
54 $datetimezone->transform([$data["server_timezone"] ?? "UTC"]),
55 $data["register_nic"] ?? false
56 );
57 });
58 }
59
63 public function getInstallObjective(Setup\Config $config = null) : Setup\Objective
64 {
68 new Setup\ObjectiveCollection(
69 "Complete common ILIAS objectives.",
70 false,
71 new Setup\Condition\PHPVersionCondition("7.2.0"),
72 new Setup\Condition\PHPExtensionLoadedCondition("dom"),
73 new Setup\Condition\PHPExtensionLoadedCondition("xsl"),
74 new Setup\Condition\PHPExtensionLoadedCondition("gd"),
77 $config->getRegisterNIC()
79 : new Setup\ObjectiveCollection(
80 "",
81 false,
84 )
85 )
86 );
87 }
88
89 protected function getPHPMemoryLimitCondition() : Setup\Objective
90 {
92 "PHP memory limit >= " . self::PHP_MEMORY_LIMIT,
93 function (Setup\Environment $env) : bool {
94 $limit = ini_get("memory_limit");
95 if ($limit == -1) {
96 return true;
97 }
98 $expected = $this->data->dataSize(self::PHP_MEMORY_LIMIT);
99 $current = $this->data->dataSize($limit);
100 return $current->inBytes() >= $expected->inBytes();
101 },
102 "To properly execute ILIAS, please take care that the PHP memory limit is at least set to 128M."
103 );
104 }
105
109 public function getUpdateObjective(Setup\Config $config = null) : Setup\Objective
110 {
111 if ($config !== null) {
113 }
115 }
116
120 public function getBuildArtifactObjective() : Setup\Objective
121 {
123 }
124
128 public function getStatusObjective(Setup\Metrics\Storage $storage) : Setup\Objective
129 {
130 return new ilSetupMetricsCollectedObjective($storage);
131 }
132
136 public function getMigrations() : array
137 {
138 return [];
139 }
140
141
142 public function getNamedObjective(string $name, Setup\Config $config = null) : Setup\Objective
143 {
144 if ($name == "registerNICKey") {
145 if (is_null($config)) {
146 throw new \RuntimeException(
147 "Missing Config for objective '$name'."
148 );
149 }
151 }
152 throw new \InvalidArgumentException(
153 "There is no named objective '$name'"
154 );
155 }
156}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
A condition that can't be met by ILIAS itself needs to be met by some external means.
A objective collection is a objective that is achieved once all subobjectives are achieved.
A non-objective, nothing to do to achieve it...
A wrapper around an objective that adds some preconditions.
There seems to already exist an ILIAS installation, an interaction with it should be confirmed.
Contains common objectives for the setup.
getInstallObjective(Setup\Config $config=null)
__construct(Refinery\Factory $refinery, Data\Factory $data)
getStatusObjective(Setup\Metrics\Storage $storage)
getUpdateObjective(Setup\Config $config=null)
getNamedObjective(string $name, Setup\Config $config=null)
getMigrations()
@inheritDoc
A transformation is a function from one datatype to another.
A agent is some component that performs part of the setup process.
Definition: Agent.php:14
A configuration for the setup.
Definition: Config.php:11
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
if($format !==null) $name
Definition: metadata.php:230
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...