ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilHttpSetupAgent.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use ILIAS\Setup;
22 use ILIAS\Refinery;
23 
24 class ilHttpSetupAgent implements Setup\Agent
25 {
27 
28  protected \ILIAS\Refinery\Factory $refinery;
29 
30  public function __construct(
31  Refinery\Factory $refinery
32  ) {
33  $this->refinery = $refinery;
34  }
35 
39  public function hasConfig(): bool
40  {
41  return true;
42  }
43 
48  {
49  return $this->refinery->custom()->transformation(function ($data): \ilHttpSetupConfig {
50  return new \ilHttpSetupConfig(
51  $data["path"],
52  isset($data["https_autodetection"]) && $data["https_autodetection"],
53  isset($data["forced"]) && $data["forced"],
54  (isset($data["https_autodetection"]) && $data["https_autodetection"])
55  ? $data["https_autodetection"]["header_name"]
56  : null,
57  (isset($data["https_autodetection"]) && $data["https_autodetection"])
58  ? $data["https_autodetection"]["header_value"]
59  : null,
60  isset($data["proxy"]) && $data["proxy"],
61  (isset($data["proxy"]) && $data["proxy"])
62  ? $data["proxy"]["host"]
63  : null,
64  (isset($data["proxy"]) && $data["proxy"])
65  ? $data["proxy"]["port"]
66  : null,
67  $data['allowed_hosts'] ?? null
68  );
69  });
70  }
71 
75  public function getInstallObjective(?Setup\Config $config = null): Setup\Objective
76  {
77  $http_config_stored = new ilHttpConfigStoredObjective($config);
78 
79  if (!$config->isProxyEnabled()) {
80  return $http_config_stored;
81  }
82 
83  return new Setup\Objective\ObjectiveWithPreconditions(
84  $http_config_stored,
85  new ProxyConnectableCondition($config)
86  );
87  }
88 
92  public function getUpdateObjective(?Setup\Config $config = null): Setup\Objective
93  {
94  if ($config !== null) {
95  return new ilHttpConfigStoredObjective($config);
96  }
97  return new Setup\Objective\NullObjective();
98  }
99 
103  public function getBuildObjective(): Setup\Objective
104  {
105  return new Setup\Objective\NullObjective();
106  }
107 
111  public function getStatusObjective(Setup\Metrics\Storage $storage): Setup\Objective
112  {
113  return new ilHttpMetricsCollectedObjective($storage);
114  }
115 
119  public function getMigrations(): array
120  {
121  return [];
122  }
123 }
getUpdateObjective(?Setup\Config $config=null)
An objective is a desired state of the system that is supposed to be created by the setup...
Definition: Objective.php:30
__construct(Refinery\Factory $refinery)
A agent is some component that performs part of the setup process.
Definition: Agent.php:29
hasConfig()
Does this agent require a configuration?
getInstallObjective(?Setup\Config $config=null)
ILIAS Refinery Factory $refinery
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Storage is simple key/value store without further schema definition.
Definition: Storage.php:29
Builds data types.
Definition: Factory.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getStatusObjective(Setup\Metrics\Storage $storage)
A transformation is a function from one datatype to another.
A configuration for the setup.
Definition: Config.php:26
getBuildObjective()
Get the goal the agent wants to achieve to build artifacts.if Config does not match the Agent...
getArrayToConfigTransformation()
Agents must be able to tell how to create a configuration from a nested array.if Agent has no Config ...