ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDatabaseSetupAgent.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
6use ILIAS\Refinery\Factory as Refinery;
8
10{
11 use Setup\Agent\HasNoNamedObjective;
12
16 protected $refinery;
17
18 public function __construct(Refinery $refinery)
19 {
20 $this->refinery = $refinery;
21 }
22
26 public function hasConfig() : bool
27 {
28 return true;
29 }
30
35 {
36 // TODO: Migrate this to refinery-methods once possible.
37 return $this->refinery->custom()->transformation(function ($data) {
38 $data["password"] = $data["password"] ?? null; // password can be empty
39 $password = $this->refinery->to()->data("password");
40 return new \ilDatabaseSetupConfig(
41 $data["type"] ?? "innodb",
42 $data["host"] ?? "localhost",
43 $data["database"] ?? "ilias",
44 $data["user"] ?? null,
45 $data["password"] ? $password->transform($data["password"]) : null,
46 $data["create_database"] ?? true,
47 $data["collation"] ?? null,
48 $data["port"] ?? 3306,
49 $data["path_to_db_dump"] ?? null
50 );
51 });
52 }
53
57 public function getInstallObjective(Setup\Config $config = null) : Setup\Objective
58 {
60 "Complete objectives from Services\Database",
61 false,
65 );
66 }
67
71 public function getUpdateObjective(Setup\Config $config = null) : Setup\Objective
72 {
73 $p = [];
74 if ($config !== null) {
75 $p[] = new \ilDatabaseConfigStoredObjective($config);
76 }
77 $p[] = new \ilDatabaseUpdatedObjective();
79 "Complete objectives from Services\Database",
80 false,
81 ...$p
82 );
83 }
84
88 public function getBuildArtifactObjective() : Setup\Objective
89 {
91 }
92
96 public function getStatusObjective(Setup\Metrics\Storage $storage) : Setup\Objective
97 {
98 return new ilDatabaseMetricsCollectedObjective($storage);
99 }
100
104 public function getMigrations() : array
105 {
106 return [];
107 }
108}
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...
getInstallObjective(Setup\Config $config=null)
@inheritdocs
getStatusObjective(Setup\Metrics\Storage $storage)
getArrayToConfigTransformation()
@inheritdocs
getUpdateObjective(Setup\Config $config=null)
@inheritdocs
$password
Definition: cron.php:14
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