ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ProxyConnectableCondition Class Reference
+ Inheritance diagram for ProxyConnectableCondition:
+ Collaboration diagram for ProxyConnectableCondition:

Public Member Functions

 __construct ($config)
 
- Public Member Functions inherited from ILIAS\Setup\Condition\ExternalConditionObjective
 __construct (string $label, callable $condition, string $message=null)
 
 getHash ()
 Get a hash for this objective.The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\Setup\Condition\ExternalConditionObjective
 $label
 
 $condition
 
 $message
 

Detailed Description

Definition at line 8 of file ProxyConnectableCondition.php.

Constructor & Destructor Documentation

◆ __construct()

ProxyConnectableCondition::__construct (   $config)

Definition at line 10 of file ProxyConnectableCondition.php.

References $config, Vendor\Package\$e, and ILIAS\GlobalScreen\Provider\__construct().

11  {
12  return parent::__construct(
13  "Can establish a connection to proxy",
14  function (Setup\Environment $env) use ($config) : bool {
15  try {
16  $host = $config->getProxyHost();
17  if (strspn($host, '.0123456789') != strlen($host) && strstr($host, '/') === false) {
18  $host = gethostbyname($host);
19  }
20  $port = $config->getProxyPort() % 65536;
21 
22  if (!fsockopen($host, $port, $errno, $errstr, 10)) {
23  throw new Exception("Can`t establish connection to proxy.");
24  }
25  } catch (\Exception $e) {
26  return false;
27  }
28 
29  return true;
30  },
31  "Can`t establish connection to proxy."
32  );
33  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
An environment holds resources to be used in the setup process.
Definition: Environment.php:11
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

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