ILIAS  release_8 Revision v8.24
class.ilChatroomServerConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\DI;
22use ILIAS\Setup;
23
28{
30
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 information about chatroom server to db";
44 }
45
46 public function isNotable(): bool
47 {
48 return true;
49 }
50
51 public function getPreconditions(Setup\Environment $environment): array
52 {
53 return [
57 ];
58 }
59
60 public function achieve(Setup\Environment $environment): Setup\Environment
61 {
62 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
63 $common_config = $environment->getConfigFor("common");
64 $filesystem_config = $environment->getConfigFor("filesystem");
65
66 // ATTENTION: This is a total abomination. It only exists to allow various
67 // sub components of the various readers to run. This is a memento to the
68 // fact, that dependency injection is something we want. Currently, every
69 // component could just service locate the whole world via the global $DIC.
70 $DIC = $GLOBALS["DIC"];
71 $GLOBALS["DIC"] = new DI\Container();
72 $GLOBALS["DIC"]["ilDB"] = $db;
73 $GLOBALS["DIC"]["ilBench"] = null;
74
75 $chatAdministrations = ilObject::_getObjectsByType('chta');
76 $chatAdministration = current($chatAdministrations);
77
78 $chat_admin = new ilChatroomAdmin((int) $chatAdministration['obj_id']);
79 $settings = $chat_admin->loadGeneralSettings();
80
81 $settings['address'] = $this->config->getAddress();
82 $settings['port'] = $this->config->getPort();
83 $settings['sub_directory'] = $this->config->getSubDirectory();
84 $settings['protocol'] = $this->config->getProtocol();
85 $settings['cert'] = $this->config->getCert();
86 $settings['key'] = $this->config->getKey();
87 $settings['dhparam'] = $this->config->getDhparam();
88 $settings['log'] = $this->config->getLog();
89 $settings['log_level'] = $this->config->getLogLevel();
90 $settings['error_log'] = $this->config->getErrorLog();
91 $settings['ilias_proxy'] = (int) $this->config->hasIliasProxy();
92 $settings['ilias_url'] = $this->config->getIliasUrl();
93 $settings['client_proxy'] = (int) $this->config->hasClientProxy();
94 $settings['client_url'] = $this->config->getClientUrl();
95 $settings['deletion_mode'] = (int) $this->config->hasDeletionMode();
96 $settings['deletion_unit'] = $this->config->getDeletionUnit();
97 $settings['deletion_value'] = $this->config->getDeletionValue();
98 $settings['deletion_time'] = $this->config->getDeletionTime();
99
100 $chat_admin->saveGeneralSettings((object) $settings);
101
102 if (!defined("CLIENT_DATA_DIR")) {
103 define(
104 "CLIENT_DATA_DIR",
105 $filesystem_config->getDataDir() . "/" . ((string) $common_config->getClientId())
106 );
107 }
108
109 $fileHandler = new ilChatroomConfigFileHandler();
110 $fileHandler->createServerConfigFile($settings);
111
112 $GLOBALS["DIC"] = $DIC;
113
114 return $environment;
115 }
116
120 public function isApplicable(Setup\Environment $environment): bool
121 {
122 return $this->config->getAddress() !== '' && $this->config->getPort() !== 0;
123 }
124}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Class ilChatroomAdmin.
static _getObjectsByType(string $obj_type="", int $owner=null)
global $DIC
Definition: feed.php:28
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
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...
Definition: Container.php:19
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...