ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilGlobalCacheSetupAgent Class Reference
+ Inheritance diagram for ilGlobalCacheSetupAgent:
+ Collaboration diagram for ilGlobalCacheSetupAgent:

Public Member Functions

 __construct (Refinery\Factory $refinery)
 
 hasConfig ()
 
 getArrayToConfigTransformation ()
 
 getInstallObjective (Setup\Config $config=null)
 
 getUpdateObjective (Setup\Config $config=null)
 
 getBuildArtifactObjective ()
 
 getStatusObjective (Setup\Metrics\Storage $storage)
 
 getMigrations ()
 
 getNamedObjectives (?Config $config=null)
 

Protected Member Functions

 convertNode (array $node)
 

Protected Attributes

ILIAS Refinery Factory $refinery
 

Detailed Description

Definition at line 27 of file class.ilGlobalCacheSetupAgent.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlobalCacheSetupAgent::__construct ( Refinery\Factory  $refinery)

Definition at line 31 of file class.ilGlobalCacheSetupAgent.php.

References $refinery, and ILIAS\Repository\refinery().

33  {
34  $this->refinery = $refinery;
35  }
+ Here is the call graph for this function:

Member Function Documentation

◆ convertNode()

ilGlobalCacheSetupAgent::convertNode ( array  $node)
protected

Definition at line 101 of file class.ilGlobalCacheSetupAgent.php.

Referenced by getArrayToConfigTransformation(), and ILIAS\Tests\GlobalCache\Setup\TestObj\getMServer().

101  : Node
102  {
103  return new Node(
104  (string) $node["host"],
105  (int) $node["port"],
106  (int) $node["weight"]
107  );
108  }
+ Here is the caller graph for this function:

◆ getArrayToConfigTransformation()

ilGlobalCacheSetupAgent::getArrayToConfigTransformation ( )

Definition at line 48 of file class.ilGlobalCacheSetupAgent.php.

References $data, ILIAS\LTI\ToolProvider\$settings, convertNode(), and ILIAS\Repository\refinery().

48  : Refinery\Transformation
49  {
50  return $this->refinery->custom()->transformation(function ($data): \ilGlobalCacheSettingsAdapter {
51  $settings = new \ilGlobalCacheSettingsAdapter();
52  if (
53  $data === null ||
54  !isset($data["components"]) ||
55  !$data["components"] ||
56  !isset($data["service"]) ||
57  $data["service"] === "none" ||
58  (
59  $data["service"] === "memcached" &&
60  (!isset($data["memcached_nodes"]) || count($data["memcached_nodes"]) === 0)
61  )
62  ) {
63  $settings->setActive(false);
64  } else {
65  $settings->setActive(true);
66  switch ($data["service"]) {
67  case "xcache": // xcache has been removed in ILIAS 8, we switch to static cache then
68  case "static":
69  $settings->setService(\ILIAS\Cache\Config::PHPSTATIC);
70  break;
71  case "memcached":
72  array_walk($data["memcached_nodes"], function (array $node) use ($settings): void {
73  $settings->addMemcachedNode($this->convertNode($node));
74  });
75  $settings->setService(\ILIAS\Cache\Config::MEMCACHED);
76  break;
77  case "apc":
78  $settings->setService(\ILIAS\Cache\Config::APCU);
79  break;
80  default:
81  throw new \InvalidArgumentException(
82  sprintf("Unknown caching service: '%s'", $data["service"])
83  );
84  }
85  $settings->resetActivatedComponents();
86  if ($data["components"] === "all") {
87  $settings->activateAll();
88  } else {
89  foreach ($data["components"] as $cmp => $active) {
90  if ($active) {
91  $settings->addActivatedComponent($cmp);
92  }
93  }
94  }
95  }
96 
97  return $settings;
98  });
99  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
Class ChatMainBarProvider .
+ Here is the call graph for this function:

◆ getBuildArtifactObjective()

ilGlobalCacheSetupAgent::getBuildArtifactObjective ( )

Definition at line 135 of file class.ilGlobalCacheSetupAgent.php.

135  : Setup\Objective
136  {
137  return new Setup\Objective\NullObjective();
138  }

◆ getInstallObjective()

ilGlobalCacheSetupAgent::getInstallObjective ( Setup\Config  $config = null)

Definition at line 113 of file class.ilGlobalCacheSetupAgent.php.

113  : Setup\Objective
114  {
115  if (!$config instanceof ilGlobalCacheSettingsAdapter) {
116  throw new Setup\UnachievableException('wrong config type, expected ilGlobalCacheSettings');
117  }
118  return new ilGlobalCacheConfigStoredObjective($config);
119  }

◆ getMigrations()

ilGlobalCacheSetupAgent::getMigrations ( )

Definition at line 151 of file class.ilGlobalCacheSetupAgent.php.

151  : array
152  {
153  return [];
154  }

◆ getNamedObjectives()

ilGlobalCacheSetupAgent::getNamedObjectives ( ?Config  $config = null)

Definition at line 156 of file class.ilGlobalCacheSetupAgent.php.

156  : array
157  {
158  $config = $config ?? new ilGlobalCacheSettingsAdapter();
159  return [
160  'flushAll' => new ObjectiveConstructor(
161  'flushes all GlobalCaches.',
162  function () use ($config) {
163  return new ilGlobalCacheAllFlushedObjective($config);
164  }
165  )
166  ];
167  }

◆ getStatusObjective()

ilGlobalCacheSetupAgent::getStatusObjective ( Setup\Metrics\Storage  $storage)

Definition at line 143 of file class.ilGlobalCacheSetupAgent.php.

◆ getUpdateObjective()

ilGlobalCacheSetupAgent::getUpdateObjective ( Setup\Config  $config = null)

Definition at line 124 of file class.ilGlobalCacheSetupAgent.php.

124  : Setup\Objective
125  {
126  if ($config instanceof ilGlobalCacheSettingsAdapter) {
127  return new ilGlobalCacheConfigStoredObjective($config);
128  }
129  return new Setup\Objective\NullObjective();
130  }

◆ hasConfig()

ilGlobalCacheSetupAgent::hasConfig ( )

Definition at line 40 of file class.ilGlobalCacheSetupAgent.php.

40  : bool
41  {
42  return true;
43  }

Field Documentation

◆ $refinery

ILIAS Refinery Factory ilGlobalCacheSetupAgent::$refinery
protected

Definition at line 29 of file class.ilGlobalCacheSetupAgent.php.

Referenced by __construct().


The documentation for this class was generated from the following file: