ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilGlobalCacheSetupAgent.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
7use ILIAS\UI;
8
10{
14 protected $refinery;
15
16 public function __construct(
17 Refinery\Factory $refinery
18 ) {
19 $this->refinery = $refinery;
20 }
21
25 public function hasConfig() : bool
26 {
27 return true;
28 }
29
33 public function getConfigInput(Setup\Config $config = null) : UI\Component\Input\Field\Input
34 {
35 throw new \LogicException("Not yet implemented.");
36 }
37
42 {
43 return $this->refinery->custom()->transformation(function ($data) {
44 $settings = new \ilGlobalCacheSettings();
45 if ($data === null || !$data["components"] || $data["service"] == "none") {
46 $settings->setActive(false);
47 } else {
48 $settings->setActive(true);
49 switch ($data["service"]) {
50 case "static":
51 $settings->setService(\ilGlobalCache::TYPE_STATIC);
52 break;
53 case "xcache":
54 $settings->setService(\ilGlobalCache::TYPE_XCACHE);
55 break;
56 case "memcached":
57 $settings->setService(\ilGlobalCache::TYPE_MEMCACHED);
58 break;
59 case "apc":
60 $settings->setService(\ilGlobalCache::TYPE_APC);
61 break;
62 default:
63 throw new \InvalidArgumentException(
64 "Unknown caching service: '{$data["service"]}'"
65 );
66 }
67 $settings->resetActivatedComponents();
68 if ($data["components"] == "all") {
69 $settings->activateAll();
70 } else {
71 foreach ($data["components"] as $cmp) {
72 $settings->addActivatedComponents($cmp);
73 }
74 }
75 }
76 return $settings;
77 });
78 }
79
83 public function getInstallObjective(Setup\Config $config = null) : Setup\Objective
84 {
86 "Complete objectives from Services/GlobalCache",
87 false,
89 );
90 }
91
95 public function getUpdateObjective(Setup\Config $config = null) : Setup\Objective
96 {
97 return new Setup\NullObjective();
98 }
99
103 public function getBuildArtifactObjective() : Setup\Objective
104 {
105 return new Setup\NullObjective();
106 }
107}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
A non-objective, nothing to do to achieve it...
A objective collection is a objective that is achieved once all subobjectives are achieved.
getUpdateObjective(Setup\Config $config=null)
getInstallObjective(Setup\Config $config=null)
__construct(Refinery\Factory $refinery)
getConfigInput(Setup\Config $config=null)
A transformation is a function from one datatype to another.
A agent is some component that performs part of the setup process.
Definition: Agent.php:14
A configuration for the setup.
Definition: Config.php:11
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
A component is the most general form of an entity in the UI.
Definition: Component.php:14
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
Class Factory.
$data
Definition: storeScorm.php:23