ILIAS  release_7 Revision v7.30-3-g800a261c036
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{
10 public function __construct(
12 ) {
14 }
15
16 public function getHash() : string
17 {
18 return hash("sha256", self::class);
19 }
20
21 public function getLabel() : string
22 {
23 return "Fill ini with common settings";
24 }
25
26 public function isNotable() : bool
27 {
28 return false;
29 }
30
31 public function getPreconditions(Setup\Environment $environment) : array
32 {
33 return [
35 ];
36 }
37
38 public function achieve(Setup\Environment $environment) : Setup\Environment
39 {
40 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
41
42 $ini->setVariable("server", "absolute_path", dirname(__DIR__, 2));
43 $ini->setVariable(
44 "server",
45 "timezone",
46 $this->config->getServerTimeZone()->getName()
47 );
48
49 $ini->setVariable("clients", "default", $this->config->getClientId());
50
51 if (!$ini->write()) {
52 throw new Setup\UnachievableException("Could not write ilias.ini.php");
53 }
54
55 return $environment;
56 }
57
61 public function isApplicable(Setup\Environment $environment) : bool
62 {
63 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
64
65 return
66 $ini->readVariable("server", "absolute_path") !== dirname(__DIR__, 2) ||
67 $ini->readVariable("server", "timezone") !== $this->config->getServerTimeZone()->getName() ||
68 $ini->readVariable("clients", "default") !== $this->config->getClientId()
69 ;
70 }
71}
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)
isApplicable(Setup\Environment $environment)
@inheritDoc
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4