mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 15:24:05 +02:00
Livestatus\Connection: throw "better" exceptions
Removed outdated method
This commit is contained in:
parent
578873f695
commit
d6b9f56a2c
@ -5,7 +5,8 @@
|
|||||||
namespace Icinga\Protocol\Livestatus;
|
namespace Icinga\Protocol\Livestatus;
|
||||||
|
|
||||||
use Icinga\Application\Benchmark;
|
use Icinga\Application\Benchmark;
|
||||||
use Exception;
|
use Icinga\Exception\ConfigurationError;
|
||||||
|
use Icinga\Exception\SystemPermissionException;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +75,7 @@ class Connection
|
|||||||
$this->assertPhpExtensionLoaded('sockets');
|
$this->assertPhpExtensionLoaded('sockets');
|
||||||
if ($socket[0] === '/') {
|
if ($socket[0] === '/') {
|
||||||
if (! is_writable($socket)) {
|
if (! is_writable($socket)) {
|
||||||
throw new IcingaException(
|
throw new SystemPermissionException(
|
||||||
'Cannot write to livestatus socket "%s"',
|
'Cannot write to livestatus socket "%s"',
|
||||||
$socket
|
$socket
|
||||||
);
|
);
|
||||||
@ -83,24 +84,18 @@ class Connection
|
|||||||
$this->socket_path = $socket;
|
$this->socket_path = $socket;
|
||||||
} else {
|
} else {
|
||||||
if (! preg_match('~^tcp://([^:]+):(\d+)~', $socket, $m)) {
|
if (! preg_match('~^tcp://([^:]+):(\d+)~', $socket, $m)) {
|
||||||
throw new IcingaException(
|
throw new ConfigurationError(
|
||||||
'Invalid TCP socket syntax: "%s"',
|
'Invalid TCP socket syntax: "%s"',
|
||||||
$socket
|
$socket
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// TODO: Better syntax checks
|
// TODO: Better config syntax checks
|
||||||
$this->socket_host = $m[1];
|
$this->socket_host = $m[1];
|
||||||
$this->socket_port = (int) $m[2];
|
$this->socket_port = (int) $m[2];
|
||||||
$this->socket_type = self::TYPE_TCP;
|
$this->socket_type = self::TYPE_TCP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function select()
|
|
||||||
{
|
|
||||||
$select = new Query($this);
|
|
||||||
return $select;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function count(Query $query)
|
public function count(Query $query)
|
||||||
{
|
{
|
||||||
return 100;
|
return 100;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user