ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMediaObjectConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
6
12{
16 protected $config;
17
18 public function __construct(
20 ) {
21 $this->config = $config;
22 }
23
24 public function getHash() : string
25 {
26 return hash("sha256", self::class);
27 }
28
29 public function getLabel() : string
30 {
31 return "Store configuration of Services/MediaObject";
32 }
33
34 public function isNotable() : bool
35 {
36 return false;
37 }
38
39 public function getPreconditions(Setup\Environment $environment) : array
40 {
41 return [
43 ];
44 }
45
46 public function achieve(Setup\Environment $environment) : Setup\Environment
47 {
48 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
49
50 $ini->setVariable("tools", "ffmpeg", $this->config->getPathToFFMPEG());
51
52 if (!$ini->write()) {
53 throw new Setup\UnachievableException("Could not write ilias.ini.php");
54 }
55
56 return $environment;
57 }
58
62 public function isApplicable(Setup\Environment $environment) : bool
63 {
64 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
65
66 return $ini->readVariable("tools", "ffmpeg") !== $this->config->getPathToFFMPEG();
67 }
68}
An exception for terminatinating execution or to throw for unit testing.
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:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4