ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
33
34 public function __construct(
35 Refinery\Factory $refinery,
36 Data\Factory $data,
38 ) {
39 $this->refinery = $refinery;
40 $this->data = $data;
41 $this->password_manager = $password_manager;
42 }
43
47 public function hasConfig() : bool
48 {
49 return true;
50 }
51
55 public function getConfigInput(Setup\Config $config = null) : UI\Component\Input\Field\Input
56 {
57 throw new \LogicException("Not yet implemented.");
58 }
59
64 {
65 return $this->refinery->custom()->transformation(function ($data) {
66 $password = $this->refinery->to()->data("password");
67 $datetimezone = $this->refinery->to()->toNew(\DateTimeZone::class);
68 return new \ilSetupConfig(
69 $data["client_id"],
70 $password->transform($data["master_password"]),
71 $datetimezone->transform([$data["server_timezone"] ?? "UTC"]),
72 $data["register_nic"] ?? false
73 );
74 });
75 }
76
80 public function getInstallObjective(Setup\Config $config = null) : Setup\Objective
81 {
85 new Setup\ObjectiveCollection(
86 "Complete common ILIAS objectives.",
87 false,
88 new Setup\PHPVersionCondition("7.2.0"),
89 new Setup\PHPExtensionLoadedCondition("dom"),
90 new Setup\PHPExtensionLoadedCondition("xsl"),
91 new Setup\PHPExtensionLoadedCondition("gd"),
93 new ilSetupConfigStoredObjective($config, $this->password_manager),
94 $config->getRegisterNIC()
97 )
98 );
99 }
100
101 protected function getPHPMemoryLimitCondition() : Setup\Objective
102 {
104 "PHP memory limit >= " . self::PHP_MEMORY_LIMIT,
105 function (Setup\Environment $env) : bool {
106 $limit = ini_get("memory_limit");
107 if ($limit == -1) {
108 return true;
109 }
110 $expected = $this->data->dataSize(self::PHP_MEMORY_LIMIT);
111 $current = $this->data->dataSize($limit);
112 return $current->inBytes() >= $expected->inBytes();
113 },
114 "To properly execute ILIAS, please take care that the PHP memory limit is at least set to 128M."
115 );
116 }
117
121 public function getUpdateObjective(Setup\Config $config = null) : Setup\Objective
122 {
123 return new Setup\NullObjective();
124 }
125
129 public function getBuildArtifactObjective() : Setup\Objective
130 {
131 return new Setup\NullObjective();
132 }
133}
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 non-objective, nothing to do to achieve it...
A objective collection is a objective that is achieved once all subobjectives are achieved.
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)
getUpdateObjective(Setup\Config $config=null)
__construct(Refinery\Factory $refinery, Data\Factory $data, \ilSetupPasswordManager $password_manager)
getConfigInput(Setup\Config $config=null)
Class ilSetupPasswordManager.
$password
Definition: cron.php:14
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
A component is the most general form of an entity in the UI.
Definition: Component.php:14
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
Class Factory.