ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUtilitiesConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
28{
30
32 {
33 $this->config = $config;
34 }
35
36 public function getHash(): string
37 {
38 return hash("sha256", self::class);
39 }
40
41 public function getLabel(): string
42 {
43 return "Store configuration of Services/Utilities";
44 }
45
46 public function isNotable(): bool
47 {
48 return false;
49 }
50
51 public function getPreconditions(Setup\Environment $environment): array
52 {
53 return [
55 ];
56 }
57
58 public function achieve(Setup\Environment $environment): Setup\Environment
59 {
60 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
61
62 $ini->setVariable("tools", "convert", $this->config->getPathToConvert());
63 $ini->setVariable("tools", "zip", $this->config->getPathToZip());
64 $ini->setVariable("tools", "unzip", $this->config->getPathToUnzip());
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
81 $ini->readVariable("tools", "convert") !== $this->config->getPathToConvert() ||
82 $ini->readVariable("tools", "zip") !== $this->config->getPathToZip() ||
83 $ini->readVariable("tools", "unzip") !== $this->config->getPathToUnzip();
84 }
85}
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.
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:20