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

Public Member Functions

 __construct (protected Refinery $refinery)
 
 hasConfig ()
 @inheritdocs More...
 
 getArrayToConfigTransformation ()
 @inheritdocs More...
 
 getInstallObjective (?Config $config=null)
 @inheritdocs More...
 
 getUpdateObjective (?Config $config=null)
 @inheritdocs More...
 
 getBuildObjective ()
 @inheritdocs More...
 
 getStatusObjective (Storage $storage)
 
 getMigrations ()
 @inheritDoc More...
 
 getNamedObjectives (?Config $config=null)
 Gets all named objectives The keys of the returned array are the commands. More...
 
- Public Member Functions inherited from ILIAS\Setup\Agent
 hasConfig ()
 Does this agent require a configuration? More...
 
 getArrayToConfigTransformation ()
 Agents must be able to tell how to create a configuration from a nested array. More...
 
 getInstallObjective (?Config $config=null)
 Get the goals the agent wants to achieve on setup. More...
 
 getUpdateObjective (?Config $config=null)
 Get the goal the agent wants to achieve on update. More...
 
 getBuildObjective ()
 Get the goal the agent wants to achieve to build artifacts. More...
 
 getStatusObjective (Metrics\Storage $storage)
 Get the objective to be achieved when status is requested. More...
 
 getMigrations ()
 Get a named map of migrations available for this Agent. More...
 
 getNamedObjectives (?Config $config=null)
 Gets all named objectives The keys of the returned array are the commands. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilDatabaseSetupAgent::__construct ( protected Refinery  $refinery)

Definition at line 37 of file class.ilDatabaseSetupAgent.php.

38 {
39 }

Member Function Documentation

◆ getArrayToConfigTransformation()

ilDatabaseSetupAgent::getArrayToConfigTransformation ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 52 of file class.ilDatabaseSetupAgent.php.

53 {
54 // TODO: Migrate this to refinery-methods once possible.
55 return $this->refinery->custom()->transformation(function ($data): \ilDatabaseSetupConfig {
56 $data["password"] ??= null; // password can be empty
57 $password = $this->refinery->to()->data("password");
58 return new \ilDatabaseSetupConfig(
59 $data["type"] ?? "innodb",
60 $data["host"] ?? "localhost",
61 $data["database"] ?? "ilias",
62 $data["user"] ?? null,
63 $data["password"] ? $password->transform($data["password"]) : null,
64 $data["create_database"] ?? true,
65 $data["collation"] ?? null,
66 (int) ($data["port"] ?? 3306),
67 $data["path_to_db_dump"] ?? null
68 );
69 });
70 }
A transformation is a function from one datatype to another.

References $data, and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getBuildObjective()

ilDatabaseSetupAgent::getBuildObjective ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 107 of file class.ilDatabaseSetupAgent.php.

107 : Objective
108 {
109 return new NullObjective();
110 }
A non-objective, nothing to do to achieve it...
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31

◆ getInstallObjective()

ilDatabaseSetupAgent::getInstallObjective ( ?Config  $config = null)

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 75 of file class.ilDatabaseSetupAgent.php.

75 : Objective
76 {
77 if (!$config instanceof \ilDatabaseSetupConfig) {
78 return new NullObjective();
79 }
80 return new ObjectiveCollection(
81 "Complete objectives from Services\Database",
82 false,
86 );
87 }
A objective collection is a objective that is achieved once all subobjectives are achieved.

◆ getMigrations()

ilDatabaseSetupAgent::getMigrations ( )

@inheritDoc

Implements ILIAS\Setup\Agent.

Definition at line 123 of file class.ilDatabaseSetupAgent.php.

◆ getNamedObjectives()

ilDatabaseSetupAgent::getNamedObjectives ( ?Config  $config = null)

Gets all named objectives The keys of the returned array are the commands.

Only the AgentCollection should return an array where the cmd of the named objective is the array key.

Parameters
Config | null$config
Returns
array<string|int, ObjectiveConstructor>

Implements ILIAS\Setup\Agent.

Definition at line 130 of file class.ilDatabaseSetupAgent.php.

130 : array
131 {
132 return [
133 'resetFailedSteps' => new ObjectiveConstructor(
134 'reset null-states in il_db_steps',
135 static fn(): Objective => new ilDatabaseResetStepsObjective()
136 )
137 ];
138 }

◆ getStatusObjective()

ilDatabaseSetupAgent::getStatusObjective ( Storage  $storage)

◆ getUpdateObjective()

ilDatabaseSetupAgent::getUpdateObjective ( ?Config  $config = null)

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 92 of file class.ilDatabaseSetupAgent.php.

92 : Objective
93 {
94 $p = [];
95 $p[] = new \ilDatabaseUpdatedObjective();
97 return new ObjectiveCollection(
98 "Complete objectives from Services\Database",
99 false,
100 ...$p
101 );
102 }

◆ hasConfig()

ilDatabaseSetupAgent::hasConfig ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 44 of file class.ilDatabaseSetupAgent.php.

44 : bool
45 {
46 return true;
47 }

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