ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilGlobalCacheAllFlushedObjective.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
21 
22 use ILIAS\Setup;
24 
26 {
27  public function __construct(private \ilGlobalCacheSettingsAdapter $cache_settings_adapter)
28  {
29  }
30 
31  public function getHash(): string
32  {
33  return hash("sha256", self::class);
34  }
35 
36  public function getLabel(): string
37  {
38  return "All global caches flushed";
39  }
40 
41  public function isNotable(): bool
42  {
43  return true;
44  }
45 
46  public function getPreconditions(Environment $environment): array
47  {
48  return [
50  ];
51  }
52 
53  public function achieve(Environment $environment): Environment
54  {
55  $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
56  if ($client_ini === null) {
57  throw new UnexpectedValueException("Client ini not found");
58  }
59  $this->cache_settings_adapter->readFromIniFile($client_ini);
60  $services = new Services($this->cache_settings_adapter->getConfig());
61  $services->flushAdapter();
62 
63  return $environment;
64  }
65 
69  public function isApplicable(Environment $environment): bool
70  {
71  return true;
72  }
73 }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
__construct(private \ilGlobalCacheSettingsAdapter $cache_settings_adapter)