ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSetupConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
24{
25 public function __construct(
27 ) {
29 }
30
31 public function getHash(): string
32 {
33 return hash("sha256", self::class);
34 }
35
36 public function getLabel(): string
37 {
38 return "Fill ini with common settings";
39 }
40
41 public function isNotable(): bool
42 {
43 return false;
44 }
45
46 public function getPreconditions(Setup\Environment $environment): array
47 {
48 return [
50 ];
51 }
52
53 public function achieve(Setup\Environment $environment): Setup\Environment
54 {
55 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
56
57 $ini->setVariable("server", "absolute_path", dirname(__DIR__, 4));
58 $ini->setVariable(
59 "server",
60 "timezone",
61 $this->config->getServerTimeZone()->getName()
62 );
63
64 $ini->setVariable("clients", "default", (string) $this->config->getClientId());
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("server", "absolute_path") !== dirname(__DIR__, 4) ||
82 $ini->readVariable("server", "timezone") !== $this->config->getServerTimeZone()->getName() ||
83 $ini->readVariable("clients", "default") !== (string) $this->config->getClientId()
84 ;
85 }
86}
Signals that some goal won't be achievable by actions of the system ever.
getPreconditions(Setup\Environment $environment)
isApplicable(Setup\Environment $environment)
@inheritDoc
A configuration for the setup.
Definition: Config.php:27
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:20