ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilHttpConfigStoredObjective.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
6
8{
12 protected $config;
13
14 public function __construct(
16 ) {
17 $this->config = $config;
18 }
19
20 public function getHash() : string
21 {
22 return hash("sha256", self::class);
23 }
24
25 public function getLabel() : string
26 {
27 return "Store configuration of Services/Http";
28 }
29
30 public function isNotable() : bool
31 {
32 return false;
33 }
34
35 public function getPreconditions(Setup\Environment $environment) : array
36 {
37 $common_config = $environment->getConfigFor("common");
38 return [
39 new ilIniFilesPopulatedObjective($common_config),
40 new \ilSettingsFactoryExistsObjective()
41 ];
42 }
43
44 public function achieve(Setup\Environment $environment) : Setup\Environment
45 {
46 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
47
48 $ini->setVariable("server", "http_path", $this->config->getHttpPath());
49 $ini->setVariable("https", "auto_https_detect_enabled", $this->config->isAutodetectionEnabled() ? "1" : "0");
50 $ini->setVariable("https", "auto_https_detect_header_name", $this->config->getHeaderName());
51 $ini->setVariable("https", "auto_https_detect_header_value", $this->config->getHeaderValue());
52
53
54 if (!$ini->write()) {
55 throw new Setup\UnachievableException("Could not write ilias.ini.php");
56 }
57
58 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
59 $settings = $factory->settingsFor("common");
60 $settings->set("proxy_status", (int) $this->config->isProxyEnabled());
61 $settings->set("proxy_host", $this->config->getProxyHost());
62 $settings->set("proxy_port", $this->config->getProxyPort());
63
64 return $environment;
65 }
66}
An exception for terminatinating execution or to throw for unit testing.
Signals that some goal won't be achievable by actions of the system ever.
achieve(Setup\Environment $environment)
getPreconditions(Setup\Environment $environment)
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
$factory
Definition: metadata.php:58
$ini
Definition: raiseError.php:4