ILIAS  release_8 Revision v8.24
class.ilPreviewConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Setup;
20
22{
23 protected \ilPreviewSetupConfig $config;
24
25 public function __construct(
27 ) {
28 $this->config = $config;
29 }
30
31 public function getHash(): string
32 {
33 return hash("sha256", self::class);
34 }
35
36 public function getLabel(): string
37 {
38 return "Store configuration of Services/Preview";
39 }
40
41 public function isNotable(): bool
42 {
43 return false;
44 }
45
49 public function getPreconditions(Setup\Environment $environment): array
50 {
51 return [
53 ];
54 }
55
56 public function achieve(Setup\Environment $environment): Setup\Environment
57 {
58 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
59
60 $ini->setVariable(
61 "tools",
62 "ghostscript",
63 $this->config->getPathToGhostscript() ?? ''
64 );
65
66 if (!$ini->write()) {
67 throw new Setup\UnachievableException("Could not write ilias.ini.php");
68 }
69
70 return $environment;
71 }
72
76 public function isApplicable(Setup\Environment $environment): bool
77 {
78 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
79
80 return $ini->readVariable("tools", "ghostscript") !== $this->config->getPathToGhostscript();
81 }
82}
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