ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilChatroomSetupAgent Class Reference
+ Inheritance diagram for ilChatroomSetupAgent:
+ Collaboration diagram for ilChatroomSetupAgent:

Public Member Functions

 __construct (Refinery\Factory $refinery)
 
 hasConfig ()
 
 getConfigInput (Setup\Config $config=null)
 
 getArrayToConfigTransformation ()
 
 getInstallObjective (Setup\Config $config=null)
 
 getUpdateObjective (Setup\Config $config=null)
 
 getBuildArtifactObjective ()
 
 getStatusObjective (Setup\Metrics\Storage $storage)
 
 getMigrations ()
 

Static Public Attributes

static array $LOG_LEVELS
 
static array $INTERVALS
 

Protected Attributes

Refinery Factory $refinery
 

Private Attributes

const PORT_MIN = 1
 
const PORT_MAX = 65535
 

Detailed Description

Definition at line 25 of file class.ilChatroomSetupAgent.php.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomSetupAgent::__construct ( Refinery\Factory  $refinery)

Definition at line 55 of file class.ilChatroomSetupAgent.php.

References $refinery, and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ getArrayToConfigTransformation()

ilChatroomSetupAgent::getArrayToConfigTransformation ( )

Definition at line 79 of file class.ilChatroomSetupAgent.php.

References $data, and ILIAS\Repository\refinery().

79  : Refinery\Transformation
80  {
81  $levels = self::$LOG_LEVELS;
82  $intervals = self::$INTERVALS;
83 
84  return $this->refinery->custom()->transformation(static function ($data) use (
85  $levels,
86  $intervals
87  ): Setup\Config {
88  if (is_null($data)) {
89  return new Setup\NullConfig();
90  }
91 
92  $protocol = 'http';
93  if (isset($data['https']) && is_array($data['https']) && $data['https'] !== []) {
94  $protocol = 'https';
95  }
96 
97  $deletion_interval = false;
98  if (
99  isset($data['deletion_interval']) &&
100  is_array($data['deletion_interval']) && $data['deletion_interval'] !== []
101  ) {
102  $deletion_interval = true;
103  }
104 
105  $ilias_proxy = false;
106  if (isset($data['ilias_proxy']) && is_array($data['ilias_proxy']) && $data['ilias_proxy'] !== []) {
107  $ilias_proxy = true;
108  }
109 
110  $client_proxy = false;
111  if (isset($data['client_proxy']) && is_array($data['client_proxy']) && $data['client_proxy'] !== []) {
112  $client_proxy = true;
113  }
114 
115  if (isset($data['address']) && !is_string($data['address'])) {
116  throw new InvalidArgumentException(sprintf(
117  '%s is not a valid value for address (must be a string). Please check your config file.',
118  $data['address'],
119  ));
120  }
121 
122  if (
123  isset($data['port']) && (
124  !is_numeric($data['port']) ||
125  ((int) $data['port'] < self::PORT_MIN || (int) $data['port'] > self::PORT_MAX)
126  )
127  ) {
128  throw new InvalidArgumentException(sprintf(
129  '%s is not a valid value for port (must be between %s and %s). Please check your config file.',
130  $data['port'] ?? '',
131  self::PORT_MIN,
132  self::PORT_MAX
133  ));
134  }
135 
136  if (isset($data['sub_directory']) && !is_string($data['sub_directory'])) {
137  throw new InvalidArgumentException(sprintf(
138  '%s is not a valid value for sub_directory (must be a string). Please check your config file.',
139  $data['sub_directory'],
140  ));
141  }
142 
143  if (isset($data['log']) && !is_string($data['log'])) {
144  throw new InvalidArgumentException(sprintf(
145  '%s is not a valid value for log (must be a string). Please check your config file.',
146  $data['log'],
147  ));
148  }
149 
150  if (isset($data['error_log']) && !is_string($data['error_log'])) {
151  throw new InvalidArgumentException(sprintf(
152  '%s is not a valid value for error_log (must be a string). Please check your config file.',
153  $data['error_log'],
154  ));
155  }
156 
157  if (
158  isset($data['log']) && $data['log'] !== '' &&
159  !in_array((string) ($data['log_level'] ?? ''), $levels, true)
160  ) {
161  throw new InvalidArgumentException(sprintf(
162  '%s is not a valid value for log_level (must be one of: %s). Please check your config file.',
163  $data['log_level'] ?? '',
164  implode(', ', $levels)
165  ));
166  }
167 
168  if ($deletion_interval) {
169  if (!in_array($data['deletion_interval']['deletion_unit'] ?? null, $intervals, true)) {
170  throw new InvalidArgumentException(sprintf(
171  '%s is not a valid value for deletion_unit (must be one of: %s). Please check your config file.',
172  $data['deletion_interval']['deletion_unit'] ?? '',
173  implode(', ', $intervals)
174  ));
175  }
176  if (
177  !isset($data['deletion_interval']['deletion_value']) ||
178  !is_numeric($data['deletion_interval']['deletion_value'])
179  ) {
180  throw new InvalidArgumentException(sprintf(
181  '%s is not a valid value for deletion_value. Please check your config file.',
182  $data['deletion_interval']['deletion_value'] ?? ''
183  ));
184  }
185  if (
186  !isset($data['deletion_interval']['deletion_time']) ||
187  !is_string($data['deletion_interval']['deletion_time']) ||
188  !preg_match('/([01][0-9]|[2][0-3]):[0-5][0-9]/', $data['deletion_interval']['deletion_time'])
189  ) {
190  throw new InvalidArgumentException(sprintf(
191  '%s is not a valid value for deletion_time. Please check your config file.',
192  $data['deletion_interval']['deletion_time'] ?? ''
193  ));
194  }
195  }
196 
197  return new ilChatroomSetupConfig(
198  $data['address'] ?? '',
199  (int) ($data['port'] ?? 0),
200  $data['sub_directory'] ?? '',
201  $protocol,
202  $data['https']['cert'] ?? '',
203  $data['https']['key'] ?? '',
204  $data['https']['dhparam'] ?? '',
205  $data['log'] ?? '',
206  $data['log_level'] ?? '',
207  $data['error_log'] ?? '',
208  $ilias_proxy,
209  $data['ilias_proxy']['ilias_url'] ?? '',
210  $client_proxy,
211  $data['client_proxy']['client_url'] ?? '',
212  $deletion_interval,
213  $data['deletion_interval']['deletion_unit'] ?? '',
214  (int) ($data['deletion_interval']['deletion_value'] ?? 0),
215  $data['deletion_interval']['deletion_time'] ?? ''
216  );
217  });
218  }
A configuration for the setup.
Definition: Config.php:26
+ Here is the call graph for this function:

◆ getBuildArtifactObjective()

ilChatroomSetupAgent::getBuildArtifactObjective ( )

Definition at line 251 of file class.ilChatroomSetupAgent.php.

251  : Setup\Objective
252  {
253  return new Setup\Objective\NullObjective();
254  }

◆ getConfigInput()

ilChatroomSetupAgent::getConfigInput ( Setup\Config  $config = null)

Definition at line 71 of file class.ilChatroomSetupAgent.php.

71  : UI\Component\Input\Field\Input
72  {
73  throw new LogicException("Not yet implemented.");
74  }

◆ getInstallObjective()

ilChatroomSetupAgent::getInstallObjective ( Setup\Config  $config = null)

Definition at line 223 of file class.ilChatroomSetupAgent.php.

References $config.

223  : Setup\Objective
224  {
225  // null would not be valid here, because this agents strictly wants to have
226  // a config.
227  if ($config instanceof Setup\NullConfig) {
228  return new Setup\Objective\NullObjective();
229  }
230 
232  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
A configuration with no content.
Definition: NullConfig.php:26

◆ getMigrations()

ilChatroomSetupAgent::getMigrations ( )

Definition at line 267 of file class.ilChatroomSetupAgent.php.

267  : array
268  {
269  return [];
270  }

◆ getStatusObjective()

ilChatroomSetupAgent::getStatusObjective ( Setup\Metrics\Storage  $storage)

Definition at line 259 of file class.ilChatroomSetupAgent.php.

259  : Setup\Objective
260  {
261  return new ilChatroomMetricsCollectedObjective($storage);
262  }

◆ getUpdateObjective()

ilChatroomSetupAgent::getUpdateObjective ( Setup\Config  $config = null)

Definition at line 237 of file class.ilChatroomSetupAgent.php.

References $config.

237  : Setup\Objective
238  {
239  // null would be valid here, because our user might just not have passed
240  // one during update.
241  if ($config === null || $config instanceof Setup\NullConfig) {
242  return new Setup\Objective\NullObjective();
243  }
244 
246  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
A configuration with no content.
Definition: NullConfig.php:26

◆ hasConfig()

ilChatroomSetupAgent::hasConfig ( )

Definition at line 63 of file class.ilChatroomSetupAgent.php.

63  : bool
64  {
65  return true;
66  }

Field Documentation

◆ $INTERVALS

array ilChatroomSetupAgent::$INTERVALS
static
Initial value:
= [
'days',
'weeks',
'months',
'years'
]

Definition at line 46 of file class.ilChatroomSetupAgent.php.

◆ $LOG_LEVELS

array ilChatroomSetupAgent::$LOG_LEVELS
static
Initial value:
= [
'emerg',
'alert',
'crit',
'error',
'warning',
'notice',
'info',
'debug',
'silly'
]

Definition at line 33 of file class.ilChatroomSetupAgent.php.

◆ $refinery

Refinery Factory ilChatroomSetupAgent::$refinery
protected

Definition at line 53 of file class.ilChatroomSetupAgent.php.

Referenced by __construct().

◆ PORT_MAX

const ilChatroomSetupAgent::PORT_MAX = 65535
private

Definition at line 30 of file class.ilChatroomSetupAgent.php.

◆ PORT_MIN

const ilChatroomSetupAgent::PORT_MIN = 1
private

Definition at line 29 of file class.ilChatroomSetupAgent.php.


The documentation for this class was generated from the following file: