ILIAS  release_8 Revision v8.24
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 return [
40 ];
41 }
42
43 public function achieve(Setup\Environment $environment): Setup\Environment
44 {
45 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
46
47 $ini->setVariable(
48 "tools",
49 "lessc",
50 $this->config->getPathToLessc() ?? ''
51 );
52 $ini->setVariable("tools", "enable_system_styles_management", $this->config->getManageSystemStyles() ? "1" : "0");
53
54 if (!$ini->write()) {
55 throw new Setup\UnachievableException("Could not write ilias.ini.php");
56 }
57
58 return $environment;
59 }
60
64 public function isApplicable(Setup\Environment $environment): bool
65 {
66 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
67 $manage_system_styles = $this->config->getManageSystemStyles() ? "1" : "0";
68
69 return
70 $ini->readVariable("tools", "lessc") !== $this->config->getPathToLessc() ||
71 $ini->readVariable("tools", "enable_system_styles_management") !== $manage_system_styles
72 ;
73 }
74}
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:28
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4