ILIAS  release_8 Revision v8.24
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 ()
 @inheritDoc More...
 
 getNamedObjectives (?Config $config=null)
 

Protected Member Functions

 getMemcachedServer (array $node)
 

Protected Attributes

ILIAS Refinery Factory $refinery
 

Detailed Description

Definition at line 26 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().

+ Here is the call graph for this function:

Member Function Documentation

◆ getArrayToConfigTransformation()

ilGlobalCacheSetupAgent::getArrayToConfigTransformation ( )

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

48 : Refinery\Transformation
49 {
50 return $this->refinery->custom()->transformation(function ($data): \ilGlobalCacheSettings {
51 $settings = new \ilGlobalCacheSettings();
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":
70 break;
71 case "memcached":
72 array_walk($data["memcached_nodes"], function (array $node) use ($settings): void {
73 $settings->addMemcachedNode($this->getMemcachedServer($node));
74 });
76 break;
77 case "apc":
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 }
Class ilGlobalCacheSettings.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References $data, ILIAS\LTI\ToolProvider\$settings, getMemcachedServer(), ILIAS\Repository\refinery(), ilGlobalCache\TYPE_APC, ilGlobalCache\TYPE_MEMCACHED, and ilGlobalCache\TYPE_STATIC.

+ Here is the call graph for this function:

◆ getBuildArtifactObjective()

ilGlobalCacheSetupAgent::getBuildArtifactObjective ( )

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

137 : Setup\Objective
138 {
139 return new Setup\Objective\NullObjective();
140 }

◆ getInstallObjective()

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

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

115 : Setup\Objective
116 {
117 if (!$config instanceof ilGlobalCacheSettings) {
118 throw new Setup\UnachievableException('wrong config type, expected ilGlobalCacheSettings');
119 }
121 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

References $config.

◆ getMemcachedServer()

ilGlobalCacheSetupAgent::getMemcachedServer ( array  $node)
protected

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

102 {
103 $m = new ilMemcacheServer();
104 $m->setStatus(boolval($node["active"]) === true ? ilMemcacheServer::STATUS_ACTIVE : ilMemcacheServer::STATUS_INACTIVE);
105 $m->setHost((string) $node["host"]);
106 $m->setPort((int) $node["port"]);
107 $m->setWeight((int) $node["weight"]);
108
109 return $m;
110 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilMemcacheServer\STATUS_ACTIVE, and ilMemcacheServer\STATUS_INACTIVE.

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

+ Here is the caller graph for this function:

◆ getMigrations()

ilGlobalCacheSetupAgent::getMigrations ( )

@inheritDoc

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

153 : array
154 {
155 return [];
156 }

◆ getNamedObjectives()

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

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

158 : array
159 {
160 return [
161 'flushAll' => new ObjectiveConstructor(
162 'flushes all GlobalCaches.',
163 function () {
165 }
166 )
167 ];
168 }

◆ getStatusObjective()

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

◆ getUpdateObjective()

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

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

126 : Setup\Objective
127 {
128 if ($config instanceof ilGlobalCacheSettings) {
130 }
131 return new Setup\Objective\NullObjective();
132 }

References $config.

◆ 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 28 of file class.ilGlobalCacheSetupAgent.php.

Referenced by __construct().


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