ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilStaticComponentRepositoryExistsObjective.php
Go to the documentation of this file.
1 <?php
19 declare(strict_types=1);
20 
21 use ILIAS\Setup;
22 
23 class ilStaticComponentRepositoryExistsObjective implements Setup\Objective
24 {
28  public function getHash(): string
29  {
30  return hash("sha256", self::class);
31  }
32 
36  public function getLabel(): string
37  {
38  return "ilComponentRepository is initialized and stored into the environment.";
39  }
40 
44  public function isNotable(): bool
45  {
46  return true;
47  }
48 
52  public function getPreconditions(Setup\Environment $environment): array
53  {
54  return [
56  ];
57  }
58 
62  public function achieve(Setup\Environment $environment): Setup\Environment
63  {
64  $data_factory = new ILIAS\Data\Factory();
65  $component_repository = new ilArtifactComponentRepository(
66  $data_factory,
67  new ilNullPluginStateDB(),
68  $data_factory->version(ILIAS_VERSION_NUMERIC)
69  );
70 
71  return $environment->withResource(
72  Setup\Environment::RESOURCE_COMPONENT_REPOSITORY,
73  $component_repository
74  );
75  }
76 
80  public function isApplicable(Setup\Environment $environment): bool
81  {
82  return is_null($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY));
83  }
84 }
Repository interface for plugin state data.
const ILIAS_VERSION_NUMERIC
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
Repository for component data implemented over artifacts.