ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLanguageSetupAgent.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
7use ILIAS\UI;
8
10{
11 use Setup\Agent\HasNoNamedObjective;
12
16 protected $refinery;
17
22
23 public function __construct(
24 Refinery\Factory $refinery,
25 $_, // this is Data\Factory, but we do not need it...
27 ) {
28 $this->refinery = $refinery;
29 $this->il_setup_language = $il_setup_language;
30 }
31
35 public function hasConfig() : bool
36 {
37 return true;
38 }
39
44 {
45 return $this->refinery->custom()->transformation(function ($data) {
46 if (!isset($data["default_language"])) {
47 $data["default_language"] = "en";
48 }
49 return new \ilLanguageSetupConfig(
50 $data["default_language"],
51 $data["install_languages"] ?? [$data["default_language"]],
52 $data["install_local_languages"] ?? []
53 );
54 });
55 }
56
60 public function getInstallObjective(Setup\Config $config = null) : Setup\Objective
61 {
63 "Complete objectives from Services/Language",
64 false,
66 new ilLanguagesInstalledAndUpdatedObjective($config, $this->il_setup_language),
68 );
69 }
70
74 public function getUpdateObjective(Setup\Config $config = null) : Setup\Objective
75 {
76 if ($config !== null) {
78 "Complete objectives from Services/Language",
79 false,
81 new ilLanguagesInstalledAndUpdatedObjective($config, $this->il_setup_language),
83 );
84 }
85
87 "Complete objectives from Services/Language",
88 false,
89 new ilLanguagesInstalledAndUpdatedObjective(null, $this->il_setup_language),
90 );
91 }
92
96 public function getBuildArtifactObjective() : Setup\Objective
97 {
99 }
100
104 public function getStatusObjective(Setup\Metrics\Storage $storage) : Setup\Objective
105 {
106 return new ilLanguageMetricsCollectedObjective($storage, $this->il_setup_language);
107 }
108
112 public function getMigrations() : array
113 {
114 return [];
115 }
116}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
A objective collection is a objective that is achieved once all subobjectives are achieved.
A non-objective, nothing to do to achieve it...
__construct(Refinery\Factory $refinery, $_, \ilSetupLanguage $il_setup_language)
getStatusObjective(Setup\Metrics\Storage $storage)
getInstallObjective(Setup\Config $config=null)
getUpdateObjective(Setup\Config $config=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A transformation is a function from one datatype to another.
A agent is some component that performs part of the setup process.
Definition: Agent.php:14
A configuration for the setup.
Definition: Config.php:11
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$data
Definition: storeScorm.php:23