Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public function collectFrom(Setup\Environment $environment, Setup\Metrics\Storag

$storage->storeConfigText(
"type",
$ini->readVariable("background_tasks", "concurrency"),
fn() => $ini->readVariable("background_tasks", "concurrency"),
"The type of execution used for background tasks"
);
$storage->storeConfigGauge(
"max_number_of_concurrent_tasks",
(int) $ini->readVariable("background_tasks", "number_of_concurrent_tasks"),
fn() => (int) $ini->readVariable("background_tasks", "number_of_concurrent_tasks"),
"The maximum amount of concurrent tasks used to run background tasks."
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,46 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto
if (count($settings) > 0) {
$storage->storeConfigText(
'address',
$settings['address'] ?? '',
fn() => $settings['address'] ?? '',
'IP-Address/FQN of Chat Server.'
);
$storage->storeConfigText(
'port',
(string) ($settings['port'] ?? ''),
fn() => (string) ($settings['port'] ?? ''),
'Port of the chat server.'
);
$storage->storeConfigText(
'sub_directory',
$settings['sub_directory'] ?? '',
fn() => $settings['sub_directory'] ?? '',
'http(s)://[IP/Domain]/[SUB_DIRECTORY]'
);

$storage->storeConfigText(
'protocol',
$settings['protocol'] ?? '',
fn() => $settings['protocol'] ?? '',
'Protocol used for connection (http/https).'
);

if (isset($settings['protocol']) && $settings['protocol'] === 'https') {
$cert = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['cert'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['cert'] ?? ''
);
$key = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['key'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['key'] ?? ''
);
$dhparam = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['dhparam'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['dhparam'] ?? ''
);
$https = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::COLLECTION,
fn() => [
'cert' => $cert,
'key' => $key,
'dhparam' => $dhparam,
Expand All @@ -105,30 +105,30 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto

$storage->storeConfigText(
'log',
(string) ($settings['log'] ?? ''),
fn() => (string) ($settings['log'] ?? ''),
"Absolute server path to the chat server's log file."
);
$storage->storeConfigText(
'log_level',
$settings['log_level'] ?? '',
fn() => $settings['log_level'] ?? '',
'Possible values are emerg, alert, crit error, warning, notice, info, debug, silly.'
);
$storage->storeConfigText(
'error_log',
$settings['error_log'] ?? '',
fn() => $settings['error_log'] ?? '',
"Absolute server path to the chat server's error log file."
);

if (isset($settings['ilias_proxy']) && $settings['ilias_proxy']) {
$ilias_url = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['ilias_url'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['ilias_url'] ?? ''
);
$ilias_proxy = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::COLLECTION,
fn() => [
'ilias_url' => $ilias_url
],
'Holds proxy url if ILIAS proxy is enabled.'
Expand All @@ -137,21 +137,21 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto
} else {
$storage->storeConfigBool(
'ilias_proxy',
false,
fn() => false,
'Holds proxy url if ILIAS proxy is enabled.'
);
}

if (isset($settings['client_proxy']) && $settings['client_proxy']) {
$client_url = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['client_url'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['client_url'] ?? ''
);
$client_proxy = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::COLLECTION,
fn() => [
'client_url' => $client_url
],
'Holds proxy url if client proxy is enabled.'
Expand All @@ -160,31 +160,31 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto
} else {
$storage->storeConfigBool(
'client_proxy',
false,
fn() => false,
'Holds proxy url if client proxy is enabled.'
);
}

if (isset($settings['deletion_mode']) && $settings['deletion_mode']) {
$deletion_unit = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['deletion_unit'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['deletion_unit'] ?? ''
);
$deletion_value = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
(string) ($settings['deletion_value'] ?? '')
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => (string) ($settings['deletion_value'] ?? '')
);
$deletion_time = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['deletion_time'] ?? ''
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::TEXT,
fn() => $settings['deletion_time'] ?? ''
);
$deletion_mode = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
Setup\Metrics\MetricStability::CONFIG,
Setup\Metrics\MetricType::COLLECTION,
fn() => [
'deletion_unit' => $deletion_unit,
'deletion_value' => $deletion_value,
'deletion_time' => $deletion_time,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,32 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto
if ($client_ini) {
$storage->storeConfigText(
"type",
$client_ini->readVariable("db", "type") ?? "mysql",
fn() => $client_ini->readVariable("db", "type") ?? "mysql",
"The storage backend that is used for the database."
);
$storage->storeConfigText(
"host",
$client_ini->readVariable("db", "host"),
fn() => $client_ini->readVariable("db", "host"),
"The host where the storage backend is located."
);
$storage->storeConfigText(
"port",
$client_ini->readVariable("db", "port"),
fn() => $client_ini->readVariable("db", "port"),
"The port where the storage backend is located at the host."
);
$storage->storeConfigText(
"name",
$client_ini->readVariable("db", "name"),
fn() => $client_ini->readVariable("db", "name"),
"The name of the database in the storage backend."
);
$storage->storeConfigText(
"user",
$client_ini->readVariable("db", "user"),
fn() => $client_ini->readVariable("db", "user"),
"The user to be used for the storage backend."
);
$storage->storeConfigText(
"pass",
PHP_SAPI === 'cli' ? $client_ini->readVariable("db", "pass") : '********',
fn() => PHP_SAPI === 'cli' ? $client_ini->readVariable("db", "pass") : '********',
"The password for the user for the storage backend."
);
}
Expand Down Expand Up @@ -138,17 +138,17 @@ public function write(): void

$storage->storeStableCounter(
"custom_version",
$db_update->getCustomUpdatesCurrentVersion() ?? 0,
fn() => $db_update->getCustomUpdatesCurrentVersion() ?? 0,
"The version of the custom database schema that is currently installed."
);
$storage->storeStableCounter(
"available_custom_version",
$db_update->getCustomUpdatesFileVersion() ?? 0,
fn() => $db_update->getCustomUpdatesFileVersion() ?? 0,
"The version of the custom database schema that is available in the current source."
);
$storage->storeStableBool(
"custom_update_required",
$db_update->customUpdatesAvailable(),
fn() => $db_update->customUpdatesAvailable(),
"Does the database require a custom update?"
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Setup;
use ILIAS\Setup\Metrics\Metric;
use ILIAS\Setup\Metrics\Storage;
Expand All @@ -40,30 +40,30 @@ protected function collectFrom(Setup\Environment $environment, Storage $storage)
$step_reader = $environment->getResource(ilDBStepReader::class);

$version = new Metric(
Metric::STABILITY_STABLE,
Metric::TYPE_TEXT,
(string) ($execution_log->getLastFinishedStep($this->step_class))
Setup\Metrics\MetricStability::STABLE,
Setup\Metrics\MetricType::TEXT,
fn() => (string) ($execution_log->getLastFinishedStep($this->step_class))
);

$available_version = new Metric(
Metric::STABILITY_STABLE,
Metric::TYPE_TEXT,
(string) $step_reader->getLatestStepNumber($this->step_class, self::STEP_METHOD_PREFIX)
Setup\Metrics\MetricStability::STABLE,
Setup\Metrics\MetricType::TEXT,
fn() => (string) $step_reader->getLatestStepNumber($this->step_class, self::STEP_METHOD_PREFIX)
);

$update_required = new Metric(
Metric::STABILITY_STABLE,
Metric::TYPE_BOOL,
$execution_log->getLastFinishedStep($this->step_class) !== $step_reader->getLatestStepNumber(
Setup\Metrics\MetricStability::STABLE,
Setup\Metrics\MetricType::BOOL,
fn() => $execution_log->getLastFinishedStep($this->step_class) !== $step_reader->getLatestStepNumber(
$this->step_class,
self::STEP_METHOD_PREFIX
)
);

$collection = new Metric(
Metric::STABILITY_STABLE,
Metric::TYPE_COLLECTION,
[
Setup\Metrics\MetricStability::STABLE,
Setup\Metrics\MetricType::COLLECTION,
fn() => [
"version" => $version,
"available_version" => $available_version,
"update_required" => $update_required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function collectFrom(Setup\Environment $environment, Storage $storage)
if ($ini) {
$storage->storeConfigText(
"data_dir",
$ini->readVariable("clients", "datadir"),
fn() => $ini->readVariable("clients", "datadir"),
"Filesystem location where ILIAS stores data outside of direct web access."
);
}
Expand Down
Loading