ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilDBStepExecutionDBExistsObjective.php
Go to the documentation of this file.
1 <?php
2 
19 use ILIAS\Setup;
20 use ILIAS\DI;
21 
22 class ilDBStepExecutionDBExistsObjective implements Setup\Objective
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(Setup\Environment $environment): array
40  {
41  return [
42  new \ilDatabaseUpdatedObjective()
43  ];
44  }
45 
46  public function achieve(Setup\Environment $environment): Setup\Environment
47  {
48  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
49 
50  return $environment
51  ->withResource(
52  \ilDatabaseUpdateStepExecutionLog::class,
54  $db,
55  fn() => new \DateTime()
56  )
57  );
58  }
59 
63  public function isApplicable(Setup\Environment $environment): bool
64  {
65  $execution_db = $environment->getResource(\ilDatabaseUpdateStepExecutionLog::class);
66  return is_null($execution_db);
67  }
68 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Container.php:19
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
Definition: Environment.php:27