ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilNoVersionDowngradeConditionObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22use ILIAS\Data;
23
25{
26 protected Data\Factory $data_factory;
27
29 {
30 $this->data_factory = $data_factory;
31 }
32
33 public function getHash(): string
34 {
35 return hash(
36 "sha256",
37 get_class($this)
38 );
39 }
40
41 public function getLabel(): string
42 {
43 return "No downgrade is performed.";
44 }
45
46 public function isNotable(): bool
47 {
48 return true;
49 }
50
51 public function getPreconditions(Setup\Environment $environment): array
52 {
53 return [
55 ];
56 }
57
58 public function achieve(Setup\Environment $environment): Setup\Environment
59 {
60 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
61 $settings = $factory->settingsFor("common");
62
63 $current_version = $this->data_factory->version($settings->get(ilVersionWrittenToSettingsObjective::ILIAS_VERSION_KEY));
64 $target_version = $this->data_factory->version(ILIAS_VERSION_NUMERIC);
65
66 if ($target_version->isSmallerThan($current_version)) {
68 "Downgrades of versions may not be performed, you are running " .
69 "$current_version and target $target_version"
70 );
71 }
72
73 return $environment;
74 }
75
76 public function isApplicable(Setup\Environment $environment): bool
77 {
78 return true;
79 }
80}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Signals that the setup is not executable at all.
const ILIAS_VERSION_NUMERIC
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.
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...