ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMediaObjectConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19use ILIAS\Setup;
20
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}
Signals that some goal won't be achievable by actions of the system ever.
Stores configuration for the service (currently only path to ffmpeg) in the according ini-field.
isApplicable(Setup\Environment $environment)
@inheritDoc
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:20