|
Revision 8935, 1.0 kB
(checked in by p_lindheimer, 3 years ago)
|
fixes #4082 get listen_port from op_server.cfg if set
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
class procinfo { |
|---|
| 4 |
var $distro; |
|---|
| 5 |
|
|---|
| 6 |
function procinfo($distro = false) { |
|---|
| 7 |
$this->distro = $distro; |
|---|
| 8 |
} |
|---|
| 9 |
|
|---|
| 10 |
function check_port($port, $server = "localhost") { |
|---|
| 11 |
$timeout = 5; |
|---|
| 12 |
if ($sock = @fsockopen($server, $port, $errno, $errstr, $timeout)) { |
|---|
| 13 |
fclose($sock); |
|---|
| 14 |
return true; |
|---|
| 15 |
} |
|---|
| 16 |
return false; |
|---|
| 17 |
} |
|---|
| 18 |
|
|---|
| 19 |
function check_fop_server() { |
|---|
| 20 |
global $amp_conf; |
|---|
| 21 |
$fop_settings = parse_ini_file($amp_conf['FOPWEBROOT'].'/op_server.cfg'); |
|---|
| 22 |
if (is_array($fop_settings)) { |
|---|
| 23 |
$listen_port = isset($fop_settings['listen_port']) && trim($fop_settings['listen_port']) != ''?$fop_settings['listen_port']:4445; |
|---|
| 24 |
} else { |
|---|
| 25 |
$listen_port = 4445; |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
return $this->check_port($listen_port); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
function check_mysql($hoststr) { |
|---|
| 32 |
$host = 'localhost'; |
|---|
| 33 |
$port = '3306'; |
|---|
| 34 |
if (preg_match('/^([^:]+)(:(\d+))?$/',$hoststr,$matches)) { |
|---|
| 35 |
|
|---|
| 36 |
$host = $matches[1]; |
|---|
| 37 |
if (!empty($matches[3])) { |
|---|
| 38 |
$port = $matches[3]; |
|---|
| 39 |
} |
|---|
| 40 |
} |
|---|
| 41 |
return $this->check_port($port, $host); |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
?> |
|---|
| 46 |
|
|---|