ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilVersionWrittenToSettingsObjective.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 public const ILIAS_VERSION_KEY = "ilias_version";
27
28 protected Data\Factory $data_factory;
29
31 {
32 $this->data_factory = $data_factory;
33 }
34
35 public function getHash(): string
36 {
37 return hash(
38 "sha256",
39 get_class($this)
40 );
41 }
42
43 public function getLabel(): string
44 {
45 return "The ILIAS Version is written to the settings.";
46 }
47
48 public function isNotable(): bool
49 {
50 return true;
51 }
52
53 public function getPreconditions(Setup\Environment $environment): array
54 {
55 return [
57 ];
58 }
59
60 public function achieve(Setup\Environment $environment): Setup\Environment
61 {
62 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
63 $settings = $factory->settingsFor("common");
64
65 $current_version = $this->data_factory->version(ILIAS_VERSION_NUMERIC);
66 $settings->set(self::ILIAS_VERSION_KEY, (string) $current_version);
67
68 return $environment;
69 }
70
71 public function isApplicable(Setup\Environment $environment): bool
72 {
73 return true;
74 }
75}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
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...