ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDatabaseResetStepsObjective Class Reference
+ Inheritance diagram for ilDatabaseResetStepsObjective:
+ Collaboration diagram for ilDatabaseResetStepsObjective:

Public Member Functions

 __construct ()
 
 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)
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective\AdminConfirmedObjective
 __construct (string $message)
 
 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. 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 (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\Setup\Objective\AdminConfirmedObjective
string $message
 

Detailed Description

Definition at line 25 of file class.ilDatabaseResetStepsObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilDatabaseResetStepsObjective::__construct ( )

Definition at line 27 of file class.ilDatabaseResetStepsObjective.php.

References ILIAS\GlobalScreen\Provider\__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  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ achieve()

ilDatabaseResetStepsObjective::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

Implements ILIAS\Setup\Objective.

Definition at line 68 of file class.ilDatabaseResetStepsObjective.php.

References ILIAS\Setup\Environment\getResource().

68  : 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  }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
+ Here is the call graph for this function:

◆ getHash()

ilDatabaseResetStepsObjective::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 41 of file class.ilDatabaseResetStepsObjective.php.

41  : string
42  {
43  return hash("sha256", self::class);
44  }

◆ getLabel()

ilDatabaseResetStepsObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 47 of file class.ilDatabaseResetStepsObjective.php.

47  : string
48  {
49  return "failing update steps are removed.";
50  }

◆ getPreconditions()

ilDatabaseResetStepsObjective::getPreconditions ( Environment  $environment)
Returns
[]|ClientIdReadObjective[]|[]

Implements ILIAS\Setup\Objective.

Definition at line 62 of file class.ilDatabaseResetStepsObjective.php.

◆ isApplicable()

ilDatabaseResetStepsObjective::isApplicable ( Environment  $environment)

Implements ILIAS\Setup\Objective.

Definition at line 80 of file class.ilDatabaseResetStepsObjective.php.

References ILIAS\Setup\Environment\getResource().

80  : 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  }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
+ Here is the call graph for this function:

◆ isNotable()

ilDatabaseResetStepsObjective::isNotable ( )

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

Implements ILIAS\Setup\Objective.

Definition at line 53 of file class.ilDatabaseResetStepsObjective.php.

53  : bool
54  {
55  return true;
56  }

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