ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilUtilitiesConfigStoredObjective.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
6
12{
16 protected $config;
17
18 public function __construct(
20 ) {
21 $this->config = $config;
22 }
23
24 public function getHash() : string
25 {
26 return hash("sha256", self::class);
27 }
28
29 public function getLabel() : string
30 {
31 return "Store configuration of Services/Utilities";
32 }
33
34 public function isNotable() : bool
35 {
36 return false;
37 }
38
39 public function getPreconditions(Setup\Environment $environment) : array
40 {
41 $common_config = $environment->getConfigFor("common");
42 return [
43 new ilIniFilesPopulatedObjective($common_config)
44 ];
45 }
46
47 public function achieve(Setup\Environment $environment) : Setup\Environment
48 {
49 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
50
51 $ini->setVariable("tools", "convert", $this->config->getPathToConvert());
52 $ini->setVariable("tools", "zip", $this->config->getPathToZip());
53 $ini->setVariable("tools", "unzip", $this->config->getPathToUnzip());
54
55 if (!$ini->write()) {
56 throw new Setup\UnachievableException("Could not write ilias.ini.php");
57 }
58
59 return $environment;
60 }
61}
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.
Stores configuration for the Utilities service (paths to various tools) in the according ini-fields.
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
$ini
Definition: raiseError.php:4