ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLanguageConfigStoredObjective.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{
9 public function getHash() : string
10 {
11 return hash("sha256", self::class);
12 }
13
14 public function getLabel() : string
15 {
16 return "Fill ini with settings for Services/Language";
17 }
18
19 public function isNotable() : bool
20 {
21 return false;
22 }
23
24 public function getPreconditions(Setup\Environment $environment) : array
25 {
26 return [
28 ];
29 }
30
31 public function achieve(Setup\Environment $environment) : Setup\Environment
32 {
33 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
34
35 $client_ini->setVariable("language", "default", $this->config->getDefaultLanguage());
36
37 if (!$client_ini->write()) {
38 throw new Setup\UnachievableException("Could not write client.ini.php");
39 }
40
41 return $environment;
42 }
43
47 public function isApplicable(Setup\Environment $environment) : bool
48 {
49 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
50
51 return
52 $client_ini->readVariable("language", "default") !== $this->config->getDefaultLanguage()
53 ;
54 }
55}
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.
isApplicable(Setup\Environment $environment)
@inheritDoc
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...