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

Public Member Functions

 __construct (Storage $storage, ilDatabaseUpdateSteps $steps)
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
- Public Member Functions inherited from ILIAS\Setup\Metrics\CollectedObjective
 __construct (Storage $storage)
 
 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 (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Data Fields

const STEP_METHOD_PREFIX = "step_"
 

Protected Member Functions

 collectFrom (Environment $environment, Storage $storage)
 
 getTentativePreconditions (Environment $environment)
 
- Protected Member Functions inherited from ILIAS\Setup\Metrics\CollectedObjective
 collectFrom (Setup\Environment $environment, Storage $storage)
 Attempt to gather metrics based on the provided environment. More...
 
 getTentativePreconditions (Setup\Environment $environment)
 Give preconditions that might or might not be fullfilled. More...
 

Protected Attributes

string $step_class
 
- Protected Attributes inherited from ILIAS\Setup\Metrics\CollectedObjective
Storage $storage
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDatabaseUpdateStepsMetricsCollectedObjective::__construct ( Storage  $storage,
ilDatabaseUpdateSteps  $steps 
)

Definition at line 32 of file class.ilDatabaseUpdateStepsMetricsCollectedObjective.php.

References ILIAS\GlobalScreen\Provider\__construct().

33  {
34  parent::__construct($storage);
35  $this->step_class = $steps::class;
36  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ collectFrom()

ilDatabaseUpdateStepsMetricsCollectedObjective::collectFrom ( Environment  $environment,
Storage  $storage 
)
protected

Definition at line 38 of file class.ilDatabaseUpdateStepsMetricsCollectedObjective.php.

References $version, ILIAS\Setup\Environment\getResource(), and ILIAS\Setup\Metrics\Storage\store().

38  : void
39  {
40  $execution_log = $environment->getResource(ilDatabaseUpdateStepExecutionLog::class);
41  $step_reader = $environment->getResource(ilDBStepReader::class);
42 
43  $version = new Metric(
44  Metric::STABILITY_STABLE,
45  Metric::TYPE_TEXT,
46  (string) ($execution_log->getLastFinishedStep($this->step_class))
47  );
48 
49  $available_version = new Metric(
50  Metric::STABILITY_STABLE,
51  Metric::TYPE_TEXT,
52  (string) $step_reader->getLatestStepNumber($this->step_class, self::STEP_METHOD_PREFIX)
53  );
54 
55  $update_required = new Metric(
56  Metric::STABILITY_STABLE,
57  Metric::TYPE_BOOL,
58  $execution_log->getLastFinishedStep($this->step_class) !== $step_reader->getLatestStepNumber(
59  $this->step_class,
60  self::STEP_METHOD_PREFIX
61  )
62  );
63 
64  $collection = new Metric(
65  Metric::STABILITY_STABLE,
66  Metric::TYPE_COLLECTION,
67  [
68  "version" => $version,
69  "available_version" => $available_version,
70  "update_required" => $update_required
71  ]
72  );
73 
74  $storage->store($this->step_class, $collection);
75  }
$version
Definition: plugin.php:24
store(string $key, Metric $metric)
Store some metric in the storage.
A metric is something we can measure about the system.
Definition: Metric.php:33
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:

◆ getHash()

ilDatabaseUpdateStepsMetricsCollectedObjective::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 87 of file class.ilDatabaseUpdateStepsMetricsCollectedObjective.php.

87  : string
88  {
89  return hash("sha256", static::class . $this->step_class);
90  }

◆ getLabel()

ilDatabaseUpdateStepsMetricsCollectedObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 93 of file class.ilDatabaseUpdateStepsMetricsCollectedObjective.php.

References $step_class.

93  : string
94  {
95  return "Status of database update steps in " . $this->step_class;
96  }

◆ getTentativePreconditions()

ilDatabaseUpdateStepsMetricsCollectedObjective::getTentativePreconditions ( Environment  $environment)
protected

Field Documentation

◆ $step_class

string ilDatabaseUpdateStepsMetricsCollectedObjective::$step_class
protected

Definition at line 30 of file class.ilDatabaseUpdateStepsMetricsCollectedObjective.php.

Referenced by getLabel().

◆ STEP_METHOD_PREFIX

const ilDatabaseUpdateStepsMetricsCollectedObjective::STEP_METHOD_PREFIX = "step_"

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