ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilInstIdDefaultStoredObjective.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2021 Daniel Weise <daniel.weise@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 use ILIAS\Setup;
6 
8 {
9  public function getHash() : string
10  {
11  return hash("sha256", self::class);
12  }
13 
14  public function getLabel() : string
15  {
16  return "Store default installation id.";
17  }
18 
19  public function isNotable() : bool
20  {
21  return false;
22  }
23 
24  public function getPreconditions(Setup\Environment $environment) : array
25  {
26  return [
27  new \ilSettingsFactoryExistsObjective()
28  ];
29  }
30 
31  public function achieve(Setup\Environment $environment) : Setup\Environment
32  {
33  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
34  $settings = $factory->settingsFor("common");
35 
36  $settings->set("inst_id", "0");
37 
38  return $environment;
39  }
40 
44  public function isApplicable(Setup\Environment $environment) : bool
45  {
46  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
47  $settings = $factory->settingsFor("common");
48 
49  return !(bool) $settings->get("inst_id");
50  }
51 }
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:11
getPreconditions(Setup\Environment $environment)
$factory
Definition: metadata.php:58