ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 

Data Fields

const PORT_MIN = 1
 
const PORT_MAX = 65535
 

Static Public Attributes

static $LOG_LEVELS
 
static $INTERVALS
 

Protected Attributes

 $refinery
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilChatroomSetupAgent::__construct ( Refinery\Factory  $refinery)

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

References $refinery.

41  {
42  $this->refinery = $refinery;
43  }

Member Function Documentation

◆ getArrayToConfigTransformation()

ilChatroomSetupAgent::getArrayToConfigTransformation ( )

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

References $data.

64  : Refinery\Transformation
65  {
66  $levels = self::$LOG_LEVELS;
67  $intervals = self::$INTERVALS;
68  // TODO: clean this up
69  return $this->refinery->custom()->transformation(function ($data) use ($levels, $intervals) {
70  if (is_null($data)) {
71  return new Setup\NullConfig();
72  }
73 
74  $protocol = 'http';
75  if (isset($data['https']) && count($data['https']) > 0) {
76  $protocol = 'https';
77  }
78 
79  $deletion_interval = false;
80  if (isset($data['deletion_interval']) && count($data['deletion_interval']) > 0) {
81  $deletion_interval = true;
82  }
83 
84  $ilias_proxy = false;
85  if (isset($data['ilias_proxy']) && count($data['ilias_proxy']) > 0) {
86  $ilias_proxy = true;
87  }
88 
89  $client_proxy = false;
90  if (isset($data['client_proxy']) && count($data['client_proxy']) > 0) {
91  $client_proxy = true;
92  }
93 
94  if (!is_null($data['port']) && (int) $data['port'] < self::PORT_MIN || (int) $data['port'] > self::PORT_MAX) {
95  throw new InvalidArgumentException(
96  $data['port'] . ' is not a valid value for port. Please check your config file.'
97  );
98  }
99 
100  if ($data['log'] != '') {
101  if (!in_array($data['log_level'], $levels)) {
102  throw new InvalidArgumentException(
103  $data['log_level'] . ' is not a valid value for log_level. Please check your config file.'
104  );
105  }
106  }
107 
108  if ($deletion_interval) {
109  if (!in_array($data['deletion_interval']['deletion_unit'], $intervals)) {
110  throw new InvalidArgumentException(
111  $data['deletion_interval']['deletion_unit'] . ' is not a valid value for deletion_unit. Please check your config file.'
112  );
113  }
114  if (!is_numeric($data['deletion_interval']['deletion_value'])) {
115  throw new InvalidArgumentException(
116  $data['deletion_interval']['deletion_value'] . ' is not a valid value for deletion_value. Please check your config file.'
117  );
118  }
119  if (!preg_match_all('/([01][0-9]|[2][0-3]):[0-5][0-9]/', $data['deletion_interval']['deletion_time'])) {
120  throw new InvalidArgumentException(
121  $data['deletion_interval']['deletion_time'] . ' is not a valid value for deletion_time. Please check your config file.'
122  );
123  }
124  }
125 
126  return new \ilChatroomSetupConfig(
127  $data['address'] ?? '',
128  (int) $data['port'] ?? 0,
129  $data['sub_directory'] ?? '',
130  $protocol,
131  $data['https']['cert'] ?? '',
132  $data['https']['key'] ?? '',
133  $data['https']['dhparam'] ?? '',
134  $data['log'] ?? '',
135  $data['log_level'] ?? '',
136  $data['error_log'] ?? '',
137  $ilias_proxy,
138  $data['ilias_proxy']['ilias_url'] ?? '',
139  $client_proxy,
140  $data['client_proxy']['client_url'] ?? '',
141  $deletion_interval,
142  $data['deletion_interval']['deletion_unit'] ?? '',
143  (int) $data['deletion_interval']['deletion_value'] ?? 0,
144  $data['deletion_interval']['deletion_time'] ?? ''
145  );
146  });
147  }
$data
Definition: storeScorm.php:23

◆ getBuildArtifactObjective()

ilChatroomSetupAgent::getBuildArtifactObjective ( )

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

180  : Setup\Objective
181  {
182  return new Setup\Objective\NullObjective();
183  }

◆ getConfigInput()

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

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

56  : UI\Component\Input\Field\Input
57  {
58  throw new \LogicException("Not yet implemented.");
59  }

◆ getInstallObjective()

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

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

References $config.

152  : Setup\Objective
153  {
154  // null would not be valid here, because this agents strictly wants to have
155  // a config.
156  if ($config instanceof Setup\NullConfig) {
157  return new Setup\Objective\NullObjective();
158  }
159 
161  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
A configuration with no content.
Definition: NullConfig.php:10

◆ getMigrations()

ilChatroomSetupAgent::getMigrations ( )

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

196  : array
197  {
198  return [];
199  }

◆ getStatusObjective()

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

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

188  : Setup\Objective
189  {
190  return new ilChatroomMetricsCollectedObjective($storage);
191  }

◆ getUpdateObjective()

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

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

References $config.

166  : Setup\Objective
167  {
168  // null would be valid here, because our user might just not have passed
169  // one during update.
170  if ($config === null || $config instanceof Setup\NullConfig) {
171  return new Setup\Objective\NullObjective();
172  }
173 
175  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
A configuration with no content.
Definition: NullConfig.php:10

◆ hasConfig()

ilChatroomSetupAgent::hasConfig ( )

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

48  : bool
49  {
50  return true;
51  }

Field Documentation

◆ $INTERVALS

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

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

◆ $LOG_LEVELS

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

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

◆ $refinery

ilChatroomSetupAgent::$refinery
protected

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

Referenced by __construct().

◆ PORT_MAX

const ilChatroomSetupAgent::PORT_MAX = 65535

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

◆ PORT_MIN

const ilChatroomSetupAgent::PORT_MIN = 1

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


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