ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPreviewConfigStoredObjective.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
8{
12 protected $config;
13
14 public function __construct(
16 ) {
17 $this->config = $config;
18 }
19
20 public function getHash() : string
21 {
22 return hash("sha256", self::class);
23 }
24
25 public function getLabel() : string
26 {
27 return "Store configuration of Services/Preview";
28 }
29
30 public function isNotable() : bool
31 {
32 return false;
33 }
34
35 public function getPreconditions(Setup\Environment $environment) : array
36 {
37 return [
39 ];
40 }
41
42 public function achieve(Setup\Environment $environment) : Setup\Environment
43 {
44 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
45
46 $ini->setVariable("tools", "ghostscript", $this->config->getPathToGhostscript());
47
48 if (!$ini->write()) {
49 throw new Setup\UnachievableException("Could not write ilias.ini.php");
50 }
51
52 return $environment;
53 }
54
58 public function isApplicable(Setup\Environment $environment) : bool
59 {
60 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
61
62 return $ini->readVariable("tools", "ghostscript") !== $this->config->getPathToGhostscript();
63 }
64}
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
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4