ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 34 of file ilDatabaseSetupAgent.php.

Constructor & Destructor Documentation

◆ __construct()

ilDatabaseSetupAgent::__construct ( protected Refinery  $refinery)

Definition at line 38 of file ilDatabaseSetupAgent.php.

39 {
40 }

Member Function Documentation

◆ getArrayToConfigTransformation()

ilDatabaseSetupAgent::getArrayToConfigTransformation ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 53 of file ilDatabaseSetupAgent.php.

54 {
55 // TODO: Migrate this to refinery-methods once possible.
56 return $this->refinery->custom()->transformation(function ($data): \ilDatabaseSetupConfig {
57 $data["password"] ??= null; // password can be empty
58 $password = $this->refinery->to()->data("password");
59 return new \ilDatabaseSetupConfig(
60 $data["type"] ?? "innodb",
61 $data["host"] ?? "localhost",
62 $data["database"] ?? "ilias",
63 $data["user"] ?? null,
64 $data["password"] ? $password->transform($data["password"]) : null,
65 $data["create_database"] ?? true,
66 $data["collation"] ?? null,
67 (int) ($data["port"] ?? 3306),
68 $data["path_to_db_dump"] ?? null
69 );
70 });
71 }
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 110 of file ilDatabaseSetupAgent.php.

110 : Objective
111 {
112 return new NullObjective();
113 }
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 76 of file ilDatabaseSetupAgent.php.

76 : Objective
77 {
78 if (!$config instanceof \ilDatabaseSetupConfig) {
79 return new NullObjective();
80 }
81 return new ObjectiveCollection(
82 "Complete objectives from Services\Database",
83 false,
88 );
89 }
A objective collection is a objective that is achieved once all subobjectives are achieved.
Verify that the setip is called from ILIAS root directory.

◆ getMigrations()

ilDatabaseSetupAgent::getMigrations ( )

@inheritDoc

Implements ILIAS\Setup\Agent.

Definition at line 126 of file 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 133 of file ilDatabaseSetupAgent.php.

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

◆ getStatusObjective()

ilDatabaseSetupAgent::getStatusObjective ( Storage  $storage)

◆ getUpdateObjective()

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

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 94 of file ilDatabaseSetupAgent.php.

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

◆ hasConfig()

ilDatabaseSetupAgent::hasConfig ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 45 of file ilDatabaseSetupAgent.php.

45 : bool
46 {
47 return true;
48 }

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