ILIAS  release_8 Revision v8.24
class.ilDatabaseResetStepsObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22use ILIAS\DI;
23
25{
26 public function __construct()
27 {
29 "This will reset failing steps in the setup progress. However -\n" .
30 "those steps failed for a reason!\n" .
31 "A step may fail due to a programming error, or, more likely, to some\n" .
32 "circumstances in your environment, e.g. inconsistent data in the DB,\n" .
33 "missing or unexpected files, etc.. Please double-check for the cause\n" .
34 "and only continue if you are certain about and fine with the consequences.\n" .
35 "Continue?"
36 );
37 }
38
39 public function getHash(): string
40 {
41 return hash("sha256", self::class);
42 }
43
44 public function getLabel(): string
45 {
46 return "failing update steps are removed.";
47 }
48
49 public function isNotable(): bool
50 {
51 return true;
52 }
53
57 public function getPreconditions(Setup\Environment $environment): array
58 {
59 $preconditions = [];
60 $preconditions[] = new Setup\Objective\ClientIdReadObjective();
61 $preconditions[] = new ilIniFilesPopulatedObjective();
62 $preconditions[] = new ilDatabaseInitializedObjective();
63
64 return $preconditions;
65 }
66
67 public function achieve(Setup\Environment $environment): Setup\Environment
68 {
69 $environment = parent::achieve($environment);
70 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
71 $db->manipulate('DELETE FROM il_db_steps WHERE finished IS NULL');
72 return $environment;
73 }
74
78 public function isApplicable(Setup\Environment $environment): bool
79 {
80 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
81 $query = 'SELECT class FROM il_db_steps WHERE finished IS NULL';
82 return $db->numRows($db->query($query)) > 0;
83 }
84}
Read the client id of the installation from the data directory.
isApplicable(Setup\Environment $environment)
@inheritDoc
getPreconditions(Setup\Environment $environment)
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Container.php:19
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query