ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
class.ilInstIdDefaultStoredObjective.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use 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 }
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...
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
getPreconditions(Setup\Environment $environment)