ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilStaticComponentRepositoryExistsObjective.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
21 
22 use ILIAS\Setup;
23 
24 class ilStaticComponentRepositoryExistsObjective implements Setup\Objective
25 {
29  public function getHash(): string
30  {
31  return hash("sha256", self::class);
32  }
33 
37  public function getLabel(): string
38  {
39  return "ilComponentRepository (static) is initialized and stored into the environment.";
40  }
41 
45  public function isNotable(): bool
46  {
47  return true;
48  }
49 
53  public function getPreconditions(Setup\Environment $environment): array
54  {
55  return [
58  ];
59  }
60 
64  public function achieve(Setup\Environment $environment): Setup\Environment
65  {
66  $data_factory = new ILIAS\Data\Factory();
67  $component_repository = new ilArtifactComponentRepository(
68  $data_factory,
69  new ilNullPluginStateDB(),
70  $data_factory->version(ILIAS_VERSION_NUMERIC)
71  );
72 
73  return $environment->withResource(
74  Setup\Environment::RESOURCE_COMPONENT_REPOSITORY,
75  $component_repository
76  );
77  }
78 
82  public function isApplicable(Setup\Environment $environment): bool
83  {
84  return is_null($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY));
85  }
86 }
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...
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.