ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilGlobalCacheConfigStoredObjective.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 $settings;
13
14 public function __construct(
16 ) {
17 $this->settings = $settings;
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/GlobalCache";
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 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
45
47
48 $memcached_nodes = $this->settings->getMemcachedNodes();
49 if (count($memcached_nodes) > 0) {
50 foreach ($memcached_nodes as $node) {
51 $node->create();
52 }
53 }
54
55 $this->settings->writeToIniFile($client_ini);
56
57 if (!$client_ini->write()) {
58 throw new Setup\UnachievableException("Could not write client.ini.php");
59 }
60
61 return $environment;
62 }
63
67 public function isApplicable(Setup\Environment $environment) : bool
68 {
69 // The effort to check the whole ini file is too big here.
70 return true;
71 }
72}
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
Class ilGlobalCacheSettings.
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.
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...
settings()
Definition: settings.php:2