ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getNamedObjective (string $name, Setup\Config $config=null)
 

Protected Member Functions

 getMemcachedServer (array $node)
 

Protected Attributes

 $refinery
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilGlobalCacheSetupAgent::__construct ( Refinery\Factory  $refinery)

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

References $refinery.

17  {
18  $this->refinery = $refinery;
19  }

Member Function Documentation

◆ getArrayToConfigTransformation()

ilGlobalCacheSetupAgent::getArrayToConfigTransformation ( )

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

References $data, getMemcachedServer(), ilGlobalCache\TYPE_APC, ilGlobalCache\TYPE_MEMCACHED, ilGlobalCache\TYPE_STATIC, and ilGlobalCache\TYPE_XCACHE.

32  : Refinery\Transformation
33  {
34  return $this->refinery->custom()->transformation(function ($data) {
35  $settings = new \ilGlobalCacheSettings();
36  if (
37  $data === null ||
38  !isset($data["components"]) ||
39  !$data["components"] ||
40  !isset($data["service"]) ||
41  $data["service"] === "none" ||
42  (
43  $data["service"] === "memcached" &&
44  (!isset($data["memcached_nodes"]) || count($data["memcached_nodes"]) === 0)
45  )
46  ) {
47  $settings->setActive(false);
48  } else {
49  $settings->setActive(true);
50  switch ($data["service"]) {
51  case "static":
53  break;
54  case "xcache":
56  break;
57  case "memcached":
58  array_walk($data["memcached_nodes"], function (array $node) use ($settings) {
59  $settings->addMemcachedNode($this->getMemcachedServer($node));
60  });
62  break;
63  case "apc":
64  $settings->setService(\ilGlobalCache::TYPE_APC);
65  break;
66  default:
67  throw new \InvalidArgumentException(
68  "Unknown caching service: '{$data["service"]}'"
69  );
70  }
71  $settings->resetActivatedComponents();
72  if ($data["components"] === "all") {
73  $settings->activateAll();
74  } else {
75  foreach ($data["components"] as $cmp => $active) {
76  if ($active) {
77  $settings->addActivatedComponent($cmp);
78  }
79  }
80  }
81  }
82 
83  return $settings;
84  });
85  }
$data
Definition: storeScorm.php:23
+ Here is the call graph for this function:

◆ getBuildArtifactObjective()

ilGlobalCacheSetupAgent::getBuildArtifactObjective ( )

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

120  : Setup\Objective
121  {
122  return new Setup\Objective\NullObjective();
123  }

◆ getInstallObjective()

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

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

References $config.

101  : Setup\Objective
102  {
104  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68

◆ getMemcachedServer()

ilGlobalCacheSetupAgent::getMemcachedServer ( array  $node)
protected

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

References ilMemcacheServer\STATUS_ACTIVE, and ilMemcacheServer\STATUS_INACTIVE.

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

88  {
89  $m = new ilMemcacheServer();
90  $m->setStatus(boolval($node["active"]) === true ? ilMemcacheServer::STATUS_ACTIVE : ilMemcacheServer::STATUS_INACTIVE);
91  $m->setHost((string) $node["host"]);
92  $m->setPort((int) $node["port"]);
93  $m->setWeight((int) $node["weight"]);
94 
95  return $m;
96  }
Class ilMemcacheServer.
+ Here is the caller graph for this function:

◆ getMigrations()

ilGlobalCacheSetupAgent::getMigrations ( )

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

136  : array
137  {
138  return [];
139  }

◆ getNamedObjective()

ilGlobalCacheSetupAgent::getNamedObjective ( string  $name,
Setup\Config  $config = null 
)

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

141  : Setup\Objective
142  {
143  if ($name == "flushAll") {
145  }
146  throw new InvalidArgumentException(
147  "There is no named objective '$name'"
148  );
149  }
if($format !==null) $name
Definition: metadata.php:230

◆ getStatusObjective()

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

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

◆ getUpdateObjective()

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

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

References $config.

109  : Setup\Objective
110  {
111  if ($config !== null) {
113  }
114  return new Setup\Objective\NullObjective();
115  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68

◆ hasConfig()

ilGlobalCacheSetupAgent::hasConfig ( )

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

24  : bool
25  {
26  return true;
27  }

Field Documentation

◆ $refinery

ilGlobalCacheSetupAgent::$refinery
protected

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

Referenced by __construct().


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