ILIAS  release_8 Revision v8.24
class.ilGlobalCacheConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Setup;
20
22{
23 protected \ilGlobalCacheSettings $settings;
24
25 public function __construct(
27 ) {
28 $this->settings = $settings;
29 }
30
31 public function getHash(): string
32 {
33 return hash("sha256", self::class);
34 }
35
36 public function getLabel(): string
37 {
38 return "Store configuration of Services/GlobalCache";
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 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
56 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
58 $db->manipulate("TRUNCATE TABLE il_gc_memcache_server");
59
60 $memcached_nodes = $this->settings->getMemcachedNodes();
61 foreach ($memcached_nodes as $node) {
62 $node->create();
63 }
64
65 $return = $this->settings->writeToIniFile($client_ini);
66
67 if (!$client_ini->write() || !$return) {
68 throw new Setup\UnachievableException("Could not write client.ini.php");
69 }
70
71 return $environment;
72 }
73
77 public function isApplicable(Setup\Environment $environment): bool
78 {
79 // The effort to check the whole ini file is too big here.
80 return true;
81 }
82}
isApplicable(Setup\Environment $environment)
@inheritDoc
Class ilGlobalCacheSettings.
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...