ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDatabaseResetStepsObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24
26{
27 public function __construct()
28 {
30 "This will reset failing steps in the setup progress. However -\n" .
31 "those steps failed for a reason!\n" .
32 "A step may fail due to a programming error, or, more likely, to some\n" .
33 "circumstances in your environment, e.g. inconsistent data in the DB,\n" .
34 "missing or unexpected files, etc.. Please double-check for the cause\n" .
35 "and only continue if you are certain about and fine with the consequences.\n" .
36 "Continue?"
37 );
38 }
39
40 #[\Override]
41 public function getHash(): string
42 {
43 return hash("sha256", self::class);
44 }
45
46 #[\Override]
47 public function getLabel(): string
48 {
49 return "failing update steps are removed.";
50 }
51
52 #[\Override]
53 public function isNotable(): bool
54 {
55 return true;
56 }
57
61 #[\Override]
62 public function getPreconditions(Environment $environment): array
63 {
65 }
66
67 #[\Override]
68 public function achieve(Environment $environment): Environment
69 {
70 $environment = parent::achieve($environment);
71 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
72 $db->manipulate('DELETE FROM il_db_steps WHERE finished IS NULL');
73 return $environment;
74 }
75
79 #[\Override]
80 public function isApplicable(Environment $environment): bool
81 {
82 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
83 $query = 'SELECT class FROM il_db_steps WHERE finished IS NULL';
84 return $db->numRows($db->query($query)) > 0;
85 }
86}
An admin needs to confirm something to achieve this objective.
Read the client id of the installation from the data directory.
achieve(Environment $environment)
Objectives can be achieved.
getHash()
Get a hash for this objective.The hash of two objectives must be the same, if they are the same objec...
getLabel()
Get a label that describes this objective.
isApplicable(Environment $environment)
@inheritDoc
isNotable()
Get to know if this is an interesting objective for a human.
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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc