ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilHttpConfigStoredObjective Class Reference
+ Inheritance diagram for ilHttpConfigStoredObjective:
+ Collaboration diagram for ilHttpConfigStoredObjective:

Public Member Functions

 __construct (\ilHttpSetupConfig $config)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 @inheritDoc More...
 

Protected Attributes

ilHttpSetupConfig $config
 

Detailed Description

Definition at line 23 of file class.ilHttpConfigStoredObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilHttpConfigStoredObjective::__construct ( \ilHttpSetupConfig  $config)

Definition at line 27 of file class.ilHttpConfigStoredObjective.php.

29 {
30 $this->config = $config;
31 }

References $config.

Member Function Documentation

◆ achieve()

ilHttpConfigStoredObjective::achieve ( Setup\Environment  $environment)

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

59 : Setup\Environment
60 {
61 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
62
63 $ini->setVariable(
66 $this->config->getHttpPath()
67 );
68 $ini->setVariable(
71 $this->config->isForced() ? "1" : "0"
72 );
73 $ini->setVariable(
76 $this->config->isAutodetectionEnabled() ? "1" : "0"
77 );
78 $ini->setVariable(
81 (string) $this->config->getHeaderName()
82 );
83 $ini->setVariable(
86 (string) $this->config->getHeaderValue()
87 );
88
89
90 if (!$ini->write()) {
91 throw new Setup\UnachievableException("Could not write ilias.ini.php");
92 }
93
94 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
95 $settings = $factory->settingsFor("common");
96 $settings->set("proxy_status", (string) $this->config->isProxyEnabled());
97 $settings->set("proxy_host", (string) $this->config->getProxyHost());
98 $settings->set("proxy_port", (string) $this->config->getProxyPort());
99
100 if (is_array($this->config->getAllowedHosts()) && $this->config->getAllowedHosts() !== []) {
101 $settings->set('allowed_hosts', implode(',', $this->config->getAllowedHosts()));
102 } else {
103 $settings->delete('allowed_hosts');
104 }
105
106 return $environment;
107 }
const SETTINGS_GROUP_SERVER
const SETTING_HTTP_PATH
const SETTINGS_GROUP_HTTPS
const SETTING_AUTO_HTTPS_DETECT_HEADER_VALUE
const SETTING_AUTO_HTTPS_DETECT_ENABLED
const SETTING_AUTO_HTTPS_DETECT_HEADER_NAME
const SETTING_FORCED
$ini
Definition: raiseError.php:20

References $ini, ilHTTPS\SETTING_AUTO_HTTPS_DETECT_ENABLED, ilHTTPS\SETTING_AUTO_HTTPS_DETECT_HEADER_NAME, ilHTTPS\SETTING_AUTO_HTTPS_DETECT_HEADER_VALUE, ilHTTPS\SETTING_FORCED, ilHTTPS\SETTING_HTTP_PATH, ilHTTPS\SETTINGS_GROUP_HTTPS, and ilHTTPS\SETTINGS_GROUP_SERVER.

◆ getHash()

ilHttpConfigStoredObjective::getHash ( )

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

33 : string
34 {
35 return hash("sha256", self::class);
36 }

◆ getLabel()

ilHttpConfigStoredObjective::getLabel ( )

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

38 : string
39 {
40 return "Store configuration of Services/Http";
41 }

◆ getPreconditions()

ilHttpConfigStoredObjective::getPreconditions ( Setup\Environment  $environment)
Returns
\ilIniFilesLoadedObjective[]|\ilSettingsFactoryExistsObjective[]

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

51 : array
52 {
53 return [
55 new \ilSettingsFactoryExistsObjective()
56 ];
57 }

◆ isApplicable()

ilHttpConfigStoredObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 112 of file class.ilHttpConfigStoredObjective.php.

112 : bool
113 {
114 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
115 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
116 $settings = $factory->settingsFor("common");
117
118 $detect_enabled = $this->config->isAutodetectionEnabled() ? "1" : "0";
119 $forced = $this->config->isForced() ? "1" : "0";
120
121 return
122 $ini->readVariable(ilHTTPS::SETTINGS_GROUP_SERVER, ilHTTPS::SETTING_HTTP_PATH) !== $this->config->getHttpPath() ||
124 $ini->readVariable(ilHTTPS::SETTINGS_GROUP_HTTPS, ilHTTPS::SETTING_FORCED) !== $forced ||
125 $ini->readVariable(ilHTTPS::SETTINGS_GROUP_HTTPS, ilHTTPS::SETTING_AUTO_HTTPS_DETECT_HEADER_NAME) !== $this->config->getHeaderName() ||
126 $ini->readVariable(ilHTTPS::SETTINGS_GROUP_HTTPS, ilHTTPS::SETTING_AUTO_HTTPS_DETECT_HEADER_VALUE) !== $this->config->getHeaderValue() ||
127 $settings->get("proxy_status") !== (int) $this->config->isProxyEnabled() ||
128 $settings->get("proxy_host") !== $this->config->getProxyHost() ||
129 $settings->get("proxy_port") !== $this->config->getProxyPort() ||
130 $settings->get('allowed_hosts', '') !== implode(',', $this->config->getAllowedHosts() ?? [])
131 ;
132 }

References $ini, ILIAS\Repository\int(), ilHTTPS\SETTING_AUTO_HTTPS_DETECT_ENABLED, ilHTTPS\SETTING_AUTO_HTTPS_DETECT_HEADER_NAME, ilHTTPS\SETTING_AUTO_HTTPS_DETECT_HEADER_VALUE, ilHTTPS\SETTING_FORCED, ilHTTPS\SETTING_HTTP_PATH, ilHTTPS\SETTINGS_GROUP_HTTPS, and ilHTTPS\SETTINGS_GROUP_SERVER.

+ Here is the call graph for this function:

◆ isNotable()

ilHttpConfigStoredObjective::isNotable ( )

Definition at line 43 of file class.ilHttpConfigStoredObjective.php.

43 : bool
44 {
45 return false;
46 }

Field Documentation

◆ $config

ilHttpSetupConfig ilHttpConfigStoredObjective::$config
protected

Definition at line 25 of file class.ilHttpConfigStoredObjective.php.

Referenced by __construct().


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