ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilInstIdDefaultStoredObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
24{
25 public function getHash(): string
26 {
27 return hash("sha256", self::class);
28 }
29
30 public function getLabel(): string
31 {
32 return "Store default installation id.";
33 }
34
35 public function isNotable(): bool
36 {
37 return false;
38 }
39
40 public function getPreconditions(Setup\Environment $environment): array
41 {
42 return [
43 new \ilSettingsFactoryExistsObjective()
44 ];
45 }
46
47 public function achieve(Setup\Environment $environment): Setup\Environment
48 {
49 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
50 $settings = $factory->settingsFor("common");
51
52 $settings->set("inst_id", "0");
53
54 return $environment;
55 }
56
60 public function isApplicable(Setup\Environment $environment): bool
61 {
62 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
63 $settings = $factory->settingsFor("common");
64
65 return !(bool) $settings->get("inst_id");
66 }
67}
isApplicable(Setup\Environment $environment)
@inheritDoc
getPreconditions(Setup\Environment $environment)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...