ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilHttpMetricsCollectedObjective Class Reference
+ Inheritance diagram for ilHttpMetricsCollectedObjective:
+ Collaboration diagram for ilHttpMetricsCollectedObjective:

Public Member Functions

 getTentativePreconditions (Setup\Environment $environment)
 
 collectFrom (Setup\Environment $environment, Setup\Metrics\Storage $storage)
 

Detailed Description

Definition at line 21 of file class.ilHttpMetricsCollectedObjective.php.

Member Function Documentation

◆ collectFrom()

ilHttpMetricsCollectedObjective::collectFrom ( Setup\Environment  $environment,
Setup\Metrics\Storage  $storage 
)

Definition at line 34 of file class.ilHttpMetricsCollectedObjective.php.

34  : void
35  {
36  $ilias_ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
37 
38  if ($ilias_ini) {
39  $storage->storeConfigText(
40  "http_path",
41  $ilias_ini->readVariable("server", "http_path"),
42  "URL of the server."
43  );
44  $storage->storeConfigText(
45  "https forced",
46  $ilias_ini->readVariable("https", "forced"),
47  ""
48  );
49 
50  if ($ilias_ini->readVariable("https", "auto_https_detect_enabled")) {
51  $header_name = new Setup\Metrics\Metric(
52  Setup\Metrics\Metric::STABILITY_CONFIG,
53  Setup\Metrics\Metric::TYPE_TEXT,
54  $ilias_ini->readVariable("https", "auto_https_detect_header_name"),
55  "The name of the header used for https detection in requests."
56  );
57  $header_value = new Setup\Metrics\Metric(
58  Setup\Metrics\Metric::STABILITY_CONFIG,
59  Setup\Metrics\Metric::TYPE_TEXT,
60  $ilias_ini->readVariable("https", "auto_https_detect_header_value"),
61  "The value in the named header that indicates usage of https in requests."
62  );
63  $https_metrics = new Setup\Metrics\Metric(
64  Setup\Metrics\Metric::STABILITY_CONFIG,
65  Setup\Metrics\Metric::TYPE_COLLECTION,
66  [
67  "header_name" => $header_name,
68  "header_value" => $header_value
69  ],
70  "The properties of a request used for https detection."
71  );
72  $storage->store("https_autodetection", $https_metrics);
73  } else {
74  $storage->storeConfigBool(
75  "https_autodetection",
76  false,
77  "Does the server attempt to detect https in incoming requests?"
78  );
79  }
80  }
81 
82  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
83  if (!$factory) {
84  return;
85  }
86  $settings = $factory->settingsFor("common");
87 
88  if ($settings->get("proxy_status")) {
89  $host = new Setup\Metrics\Metric(
90  Setup\Metrics\Metric::STABILITY_CONFIG,
91  Setup\Metrics\Metric::TYPE_TEXT,
92  $settings->get("proxy_host"),
93  "The host of the proxy."
94  );
95  $port = new Setup\Metrics\Metric(
96  Setup\Metrics\Metric::STABILITY_CONFIG,
97  Setup\Metrics\Metric::TYPE_TEXT,
98  $settings->get("proxy_port"),
99  "The port of the proxy."
100  );
101  $proxy = new Setup\Metrics\Metric(
102  Setup\Metrics\Metric::STABILITY_CONFIG,
103  Setup\Metrics\Metric::TYPE_COLLECTION,
104  [
105  "host" => $host,
106  "port" => $port
107  ],
108  "The proxy that is used for outgoing connections."
109  );
110  $storage->store("proxy", $proxy);
111  } else {
112  $storage->storeConfigBool(
113  "proxy",
114  false,
115  "Does the server use a proxy for outgoing connections?"
116  );
117  }
118 
119  if ($settings->get('allowed_hosts')) {
120  $storage->store(
121  'allowed_hosts',
122  new Setup\Metrics\Metric(
123  Setup\Metrics\Metric::STABILITY_CONFIG,
124  Setup\Metrics\Metric::TYPE_COLLECTION,
125  array_map(
126  static fn(string $host) => new Setup\Metrics\Metric(
127  Setup\Metrics\Metric::STABILITY_CONFIG,
128  Setup\Metrics\Metric::TYPE_TEXT,
129  $host
130  ),
131  explode(',', $settings->get('allowed_hosts'))
132  ),
133  'Collection of configured allowed hosts.'
134  )
135  );
136  }
137  }

◆ getTentativePreconditions()

ilHttpMetricsCollectedObjective::getTentativePreconditions ( Setup\Environment  $environment)
Returns
[]|[]

Definition at line 26 of file class.ilHttpMetricsCollectedObjective.php.

26  : array
27  {
28  return [
30  new \ilSettingsFactoryExistsObjective()
31  ];
32  }

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