ILIAS  release_8 Revision v8.24
class.ilHttpMetricsCollectedObjective.php
Go to the documentation of this file.
1<?php
2
4
5/******************************************************************************
6 *
7 * This file is part of ILIAS, a powerful learning management system.
8 *
9 * ILIAS is licensed with the GPL-3.0, you should have received a copy
10 * of said license along with the source code.
11 *
12 * If this is not the case or you just want to try ILIAS, you'll find
13 * us at:
14 * https://www.ilias.de
15 * https://github.com/ILIAS-eLearning
16 *
17 *****************************************************************************/
19{
23 public function getTentativePreconditions(Setup\Environment $environment): array
24 {
25 return [
27 new \ilSettingsFactoryExistsObjective()
28 ];
29 }
30
31 public function collectFrom(Setup\Environment $environment, Setup\Metrics\Storage $storage): void
32 {
33 $ilias_ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
34
35 if ($ilias_ini) {
36 $storage->storeConfigText(
37 "http_path",
38 $ilias_ini->readVariable("server", "http_path"),
39 "URL of the server."
40 );
41 $storage->storeConfigText(
42 "https forced",
43 $ilias_ini->readVariable("https", "forced"),
44 ""
45 );
46
47 if ($ilias_ini->readVariable("https", "auto_https_detect_enabled")) {
48 $header_name = new Setup\Metrics\Metric(
49 Setup\Metrics\Metric::STABILITY_CONFIG,
50 Setup\Metrics\Metric::TYPE_TEXT,
51 $ilias_ini->readVariable("https", "auto_https_detect_header_name"),
52 "The name of the header used for https detection in requests."
53 );
54 $header_value = new Setup\Metrics\Metric(
55 Setup\Metrics\Metric::STABILITY_CONFIG,
56 Setup\Metrics\Metric::TYPE_TEXT,
57 $ilias_ini->readVariable("https", "auto_https_detect_header_value"),
58 "The value in the named header that indicates usage of https in requests."
59 );
60 $https_metrics = new Setup\Metrics\Metric(
61 Setup\Metrics\Metric::STABILITY_CONFIG,
62 Setup\Metrics\Metric::TYPE_COLLECTION,
63 [
64 "header_name" => $header_name,
65 "header_value" => $header_value
66 ],
67 "The properties of a request used for https detection."
68 );
69 $storage->store("https_autodetection", $https_metrics);
70 } else {
71 $storage->storeConfigBool(
72 "https_autodetection",
73 false,
74 "Does the server attempt to detect https in incoming requests?"
75 );
76 }
77 }
78
79 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
80 if (!$factory) {
81 return;
82 }
83 $settings = $factory->settingsFor("common");
84
85 if ($settings->get("proxy_status")) {
86 $host = new Setup\Metrics\Metric(
87 Setup\Metrics\Metric::STABILITY_CONFIG,
88 Setup\Metrics\Metric::TYPE_TEXT,
89 $settings->get("proxy_host"),
90 "The host of the proxy."
91 );
92 $port = new Setup\Metrics\Metric(
93 Setup\Metrics\Metric::STABILITY_CONFIG,
94 Setup\Metrics\Metric::TYPE_TEXT,
95 $settings->get("proxy_port"),
96 "The port of the proxy."
97 );
98 $proxy = new Setup\Metrics\Metric(
99 Setup\Metrics\Metric::STABILITY_CONFIG,
100 Setup\Metrics\Metric::TYPE_COLLECTION,
101 [
102 "host" => $host,
103 "port" => $port
104 ],
105 "The proxy that is used for outgoing connections."
106 );
107 $storage->store("proxy", $proxy);
108 } else {
109 $storage->storeConfigBool(
110 "proxy",
111 false,
112 "Does the server use a proxy for outgoing connections?"
113 );
114 }
115 }
116}
A metric is something we can measure about the system.
Definition: Metric.php:34
getTentativePreconditions(Setup\Environment $environment)
collectFrom(Setup\Environment $environment, Setup\Metrics\Storage $storage)
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
$factory
Definition: metadata.php:75
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...