ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ProxyConnectableCondition.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
23
25{
26 public function __construct($config)
27 {
29 "Can establish a connection to proxy",
30 function (Setup\Environment $env) use ($config): bool {
31 try {
32 $host = $config->getProxyHost();
33 if (strspn($host, '.0123456789') != strlen($host) && strstr($host, '/') === false) {
34 $host = gethostbyname($host);
35 }
36 $port = $config->getProxyPort() % 65536;
37
38 if (!fsockopen($host, $port, $errno, $errstr, 10)) {
39 throw new Exception("Can`t establish connection to proxy.");
40 }
41 } catch (\Exception $e) {
42 return false;
43 }
44
45 return true;
46 },
47 "Can`t establish connection to proxy."
48 );
49 }
50}
A condition that can't be met by ILIAS itself needs to be met by some external means.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...