ILIAS  release_8 Revision v8.24
class.ilDatabaseSetupAgent.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22use ILIAS\Refinery\Factory as Refinery;
24
26{
27 use Setup\Agent\HasNoNamedObjective;
28
29 protected Refinery $refinery;
30
31 public function __construct(Refinery $refinery)
32 {
33 $this->refinery = $refinery;
34 }
35
39 public function hasConfig(): bool
40 {
41 return true;
42 }
43
48 {
49 // TODO: Migrate this to refinery-methods once possible.
50 return $this->refinery->custom()->transformation(function ($data): \ilDatabaseSetupConfig {
51 $data["password"] = $data["password"] ?? null; // password can be empty
52 $password = $this->refinery->to()->data("password");
53 return new \ilDatabaseSetupConfig(
54 $data["type"] ?? "innodb",
55 $data["host"] ?? "localhost",
56 $data["database"] ?? "ilias",
57 $data["user"] ?? null,
58 $data["password"] ? $password->transform($data["password"]) : null,
59 $data["create_database"] ?? true,
60 $data["collation"] ?? null,
61 (int) ($data["port"] ?? 3306),
62 $data["path_to_db_dump"] ?? null
63 );
64 });
65 }
66
70 public function getInstallObjective(Setup\Config $config = null): Setup\Objective
71 {
72 if (!$config instanceof \ilDatabaseSetupConfig) {
74 }
76 "Complete objectives from Services\Database",
77 false,
81 );
82 }
83
87 public function getUpdateObjective(Setup\Config $config = null): Setup\Objective
88 {
89 $p = [];
90 $p[] = new \ilDatabaseUpdatedObjective();
93 "Complete objectives from Services\Database",
94 false,
95 ...$p
96 );
97 }
98
102 public function getBuildArtifactObjective(): Setup\Objective
103 {
105 }
106
110 public function getStatusObjective(Setup\Metrics\Storage $storage): Setup\Objective
111 {
112 return new ilDatabaseMetricsCollectedObjective($storage);
113 }
114
118 public function getMigrations(): array
119 {
120 return [
122 ];
123 }
124
125 public function getNamedObjectives(?Setup\Config $config = null): array
126 {
127 return [
128 'resetFailedSteps' => new Setup\ObjectiveConstructor(
129 'reset null-states in il_db_steps',
130 static fn (): Setup\Objective => new ilDatabaseResetStepsObjective()
131 )
132 ];
133 }
134}
Builds data types.
Definition: Factory.php:21
A objective collection is a objective that is achieved once all subobjectives are achieved.
A non-objective, nothing to do to achieve it...
getInstallObjective(Setup\Config $config=null)
@inheritdocs
getStatusObjective(Setup\Metrics\Storage $storage)
getArrayToConfigTransformation()
@inheritdocs
getUpdateObjective(Setup\Config $config=null)
@inheritdocs
getNamedObjectives(?Setup\Config $config=null)
A transformation is a function from one datatype to another.
A agent is some component that performs part of the setup process.
Definition: Agent.php:30
A configuration for the setup.
Definition: Config.php:27
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...