ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMathJaxConfigStoredObjective.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 use ILIAS\Setup;
21 
22 class ilMathJaxConfigStoredObjective implements Setup\Objective
23 {
24  protected \ilMathJaxSetupConfig $config;
25 
26  public function __construct(\ilMathJaxSetupConfig $config)
27  {
28  $this->config = $config;
29  }
30 
31  public function getHash(): string
32  {
33  return hash("sha256", self::class);
34  }
35 
36  public function getLabel(): string
37  {
38  return "Store configuration of Services/MathJax";
39  }
40 
41  public function isNotable(): bool
42  {
43  return true;
44  }
45 
46  public function getPreconditions(Setup\Environment $environment): array
47  {
48  return [
49  new \ilSettingsFactoryExistsObjective()
50  ];
51  }
52 
53  public function achieve(Setup\Environment $environment): Setup\Environment
54  {
56  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
57  $repo = new ilMathJaxConfigSettingsRepository($factory->settingsFor('MathJax'));
58  $repo->updateConfig($this->config->applyTo($repo->getConfig()));
59 
60  return $environment;
61  }
62 
63  public function isApplicable(Setup\Environment $environment): bool
64  {
66  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
67  $repo = new ilMathJaxConfigSettingsRepository($factory->settingsFor('MathJax'));
68 
69  return $this->config->isApplicableTo($repo->getConfig());
70  }
71 }
getPreconditions(Setup\Environment $environment)
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
updateConfig(ilMathJaxConfig $config)
Update the MathNax Configuration.
$factory
Definition: metadata.php:75
Repository for storing and loading the MathJax configuration.