ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSetupConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5
7
9{
14
15 public function __construct(
18 ) {
20 $this->password_manager = $password_manager;
21 }
22
23 public function getHash() : string
24 {
25 return hash("sha256", self::class);
26 }
27
28 public function getLabel() : string
29 {
30 return "Fill ini with common settings";
31 }
32
33 public function isNotable() : bool
34 {
35 return false;
36 }
37
38 public function getPreconditions(Setup\Environment $environment) : array
39 {
40 return [
41 new ilIniFilesPopulatedObjective($this->config)
42 ];
43 }
44
45 public function achieve(Setup\Environment $environment) : Setup\Environment
46 {
47 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
48
49 $ini->setVariable(
50 "setup",
51 "pass",
52 $this->password_manager->encodePassword(
53 $this->config->getMasterPassword()->toString()
54 )
55 );
56
57 $ini->setVariable("server", "absolute_path", dirname(__DIR__, 2));
58 $ini->setVariable(
59 "server",
60 "timezone",
61 $this->config->getServerTimeZone()->getName()
62 );
63
64 $ini->setVariable("clients", "default", $this->config->getClientId());
65
66 if (!$ini->write()) {
67 throw new Setup\UnachievableException("Could not write ilias.ini.php");
68 }
69
70 return $environment;
71 }
72}
An exception for terminatinating execution or to throw for unit testing.
Signals that some goal won't be achievable by actions of the system ever.
getPreconditions(Setup\Environment $environment)
__construct(\ilSetupConfig $config, \ilSetupPasswordManager $password_manager)
Class ilSetupPasswordManager.
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ini
Definition: raiseError.php:4