ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilStyleConfigStoredObjective.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{
13 protected $config;
14
15 public function __construct(
17 ) {
18 $this->config = $config;
19 }
20
21 public function getHash() : string
22 {
23 return hash("sha256", self::class);
24 }
25
26 public function getLabel() : string
27 {
28 return "Fill ini with settings for Services/Style";
29 }
30
31 public function isNotable() : bool
32 {
33 return false;
34 }
35
36 public function getPreconditions(Setup\Environment $environment) : array
37 {
38 $common_config = $environment->getConfigFor("common");
39 return [
40 new ilIniFilesPopulatedObjective($common_config)
41 ];
42 }
43
44 public function achieve(Setup\Environment $environment) : Setup\Environment
45 {
46 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
47
48 $ini->setVariable("tools", "lessc", $this->config->getPathToLessc());
49 $ini->setVariable("tools", "enable_system_styles_management", $this->config->getManageSystemStyles() ? "1" : "0");
50
51 if (!$ini->write()) {
52 throw new Setup\UnachievableException("Could not write ilias.ini.php");
53 }
54
55 return $environment;
56 }
57}
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)
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