ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilGlobalCacheConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
22
24{
25 public function __construct(protected \ilGlobalCacheSettingsAdapter $settings)
26 {
27 }
28
29 public function getHash(): string
30 {
31 return hash("sha256", self::class);
32 }
33
34 public function getLabel(): string
35 {
36 return "Store configuration of components/ILIAS/GlobalCache_";
37 }
38
39 public function isNotable(): bool
40 {
41 return false;
42 }
43
44 public function getPreconditions(Environment $environment): array
45 {
46 return [
48 ];
49 }
50
51 public function achieve(Environment $environment): Environment
52 {
53 $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
54 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
56 $repo = new ilMemcacheNodesRepository($db);
57 $repo->deleteAll();
58
59 $memcached_nodes = $this->settings->getMemcachedNodes();
60 foreach ($memcached_nodes as $node) {
61 $repo->store($node);
62 }
63
64 $return = $this->settings->storeToIniFile($client_ini);
65
66 if (!$client_ini->write() || !$return) {
67 throw new UnachievableException("Could not write client.ini.php");
68 }
69
70 return $environment;
71 }
72
76 public function isApplicable(Environment $environment): bool
77 {
78 // The effort to check the whole ini file is too big here.
79 return true;
80 }
81}
Signals that some goal won't be achievable by actions of the system ever.
getLabel()
Get a label that describes this objective.
__construct(protected \ilGlobalCacheSettingsAdapter $settings)
getPreconditions(Environment $environment)
Objectives might depend on other objectives.
isNotable()
Get to know if this is an interesting objective for a human.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
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:31
achieve(Environment $environment)
Objectives can be achieved.