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

Public Member Functions

 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 @inheritDoc More...
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Detailed Description

Definition at line 22 of file class.ilDBStepExecutionDBExistsObjective.php.

Member Function Documentation

◆ achieve()

ilDBStepExecutionDBExistsObjective::achieve ( Environment  $environment)

Objectives can be achieved.

They might add resources to the environment when they have been achieved.

This method needs to be idempotent for a given environment. That means: if this is executed a second time, nothing new should happen. Or the other way round: if the environment already looks like desired, the objective should not take any further actions when this is called.

Exceptions

LogicException if there are unfullfilled preconditions.

Exceptions

RuntimeException if there are missing resources.

Implements ILIAS\Setup\Objective.

Definition at line 46 of file class.ilDBStepExecutionDBExistsObjective.php.

47 {
48 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
49
50 return $environment
52 \ilDatabaseUpdateStepExecutionLog::class,
54 $db,
55 fn(): \DateTime => new \DateTime()
56 )
57 );
58 }
This logs the execution of database update steps.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
withResource(string $id, $resource)

References ILIAS\Setup\Environment\getResource(), and ILIAS\Setup\Environment\withResource().

+ Here is the call graph for this function:

◆ getHash()

ilDBStepExecutionDBExistsObjective::getHash ( )

Get a hash for this objective.

The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

Definition at line 24 of file class.ilDBStepExecutionDBExistsObjective.php.

24 : string
25 {
26 return hash("sha256", self::class);
27 }

◆ getLabel()

ilDBStepExecutionDBExistsObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 29 of file class.ilDBStepExecutionDBExistsObjective.php.

29 : string
30 {
31 return "The execution log for database update steps exists.";
32 }

◆ getPreconditions()

ilDBStepExecutionDBExistsObjective::getPreconditions ( Environment  $environment)

Objectives might depend on other objectives.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Objective.

Definition at line 39 of file class.ilDBStepExecutionDBExistsObjective.php.

39 : array
40 {
41 return [
42 new \ilDatabaseUpdatedObjective()
43 ];
44 }

◆ isApplicable()

ilDBStepExecutionDBExistsObjective::isApplicable ( Environment  $environment)

@inheritDoc

Implements ILIAS\Setup\Objective.

Definition at line 63 of file class.ilDBStepExecutionDBExistsObjective.php.

63 : bool
64 {
65 $execution_db = $environment->getResource(\ilDatabaseUpdateStepExecutionLog::class);
66 return is_null($execution_db);
67 }

References ILIAS\Setup\Environment\getResource().

+ Here is the call graph for this function:

◆ isNotable()

ilDBStepExecutionDBExistsObjective::isNotable ( )

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

Definition at line 34 of file class.ilDBStepExecutionDBExistsObjective.php.

34 : bool
35 {
36 return true;
37 }

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