ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDBStepExecutionDBExistsObjective.php
Go to the documentation of this file.
1<?php
2
21
23{
24 public function getHash(): string
25 {
26 return hash("sha256", self::class);
27 }
28
29 public function getLabel(): string
30 {
31 return "The execution log for database update steps exists.";
32 }
33
34 public function isNotable(): bool
35 {
36 return true;
37 }
38
39 public function getPreconditions(Environment $environment): array
40 {
41 return [
42 new \ilDatabaseUpdatedObjective()
43 ];
44 }
45
46 public function achieve(Environment $environment): Environment
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 }
59
63 public function isApplicable(Environment $environment): bool
64 {
65 $execution_db = $environment->getResource(\ilDatabaseUpdateStepExecutionLog::class);
66 return is_null($execution_db);
67 }
68}
achieve(Environment $environment)
Objectives can be achieved.
getLabel()
Get a label that describes this objective.
getPreconditions(Environment $environment)
Objectives might depend on other objectives.
isNotable()
Get to know if this is an interesting objective for a human.
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)
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31