ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 35 of file ilDatabaseSetupAgent.php.

Constructor & Destructor Documentation

◆ __construct()

ilDatabaseSetupAgent::__construct ( protected Refinery  $refinery)

Definition at line 39 of file ilDatabaseSetupAgent.php.

40 {
41 }

Member Function Documentation

◆ getArrayToConfigTransformation()

ilDatabaseSetupAgent::getArrayToConfigTransformation ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 54 of file ilDatabaseSetupAgent.php.

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

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 111 of file ilDatabaseSetupAgent.php.

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

77 : Objective
78 {
79 if (!$config instanceof \ilDatabaseSetupConfig) {
80 return new NullObjective();
81 }
82 return new ObjectiveCollection(
83 "Complete objectives from Services\Database",
84 false,
89 );
90 }
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 127 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 135 of file ilDatabaseSetupAgent.php.

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

◆ getStatusObjective()

ilDatabaseSetupAgent::getStatusObjective ( Storage  $storage)

◆ getUpdateObjective()

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

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 95 of file ilDatabaseSetupAgent.php.

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

◆ hasConfig()

ilDatabaseSetupAgent::hasConfig ( )

@inheritdocs

Implements ILIAS\Setup\Agent.

Definition at line 46 of file ilDatabaseSetupAgent.php.

46 : bool
47 {
48 return true;
49 }

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