ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMediaObjectConfigStoredObjective.php
Go to the documentation of this file.
1 <?php
2 
19 use ILIAS\Setup;
20 
26 class ilMediaObjectConfigStoredObjective implements Setup\Objective
27 {
28  protected \ilMediaObjectSetupConfig $config;
29 
30  public function __construct(
32  ) {
33  $this->config = $config;
34  }
35 
36  public function getHash(): string
37  {
38  return hash("sha256", self::class);
39  }
40 
41  public function getLabel(): string
42  {
43  return "Store configuration of Services/MediaObject";
44  }
45 
46  public function isNotable(): bool
47  {
48  return false;
49  }
50 
51  public function getPreconditions(Setup\Environment $environment): array
52  {
53  return [
55  ];
56  }
57 
58  public function achieve(Setup\Environment $environment): Setup\Environment
59  {
60  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
61 
62  $ini->setVariable(
63  "tools",
64  "ffmpeg",
65  $this->config->getPathToFFMPEG()
66  ?? ''
67  );
68 
69  if (!$ini->write()) {
70  throw new Setup\UnachievableException("Could not write ilias.ini.php");
71  }
72 
73  return $environment;
74  }
75 
79  public function isApplicable(Setup\Environment $environment): bool
80  {
81  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
82 
83  return $ini->readVariable("tools", "ffmpeg") !== $this->config->getPathToFFMPEG();
84  }
85 }
Stores configuration for the service (currently only path to ffmpeg) in the according ini-field...
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
$ini
Definition: raiseError.php:4