mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
monitoring: Use command transports constants in the command transport factory
This commit is contained in:
parent
1b83ec3ce2
commit
0bf6dc24a8
@ -53,19 +53,21 @@ abstract class CommandTransport
|
|||||||
public static function fromConfig(Zend_Config $config)
|
public static function fromConfig(Zend_Config $config)
|
||||||
{
|
{
|
||||||
switch (strtolower($config->transport)) {
|
switch (strtolower($config->transport)) {
|
||||||
case 'remote':
|
case RemoteCommandFile::TRANSPORT:
|
||||||
$transport = new RemoteCommandFile();
|
$transport = new RemoteCommandFile();
|
||||||
break;
|
break;
|
||||||
case 'local':
|
case LocalCommandFile::TRANSPORT:
|
||||||
case '': // Casting null to string is the empty string
|
case '': // Casting null to string is the empty string
|
||||||
$transport = new LocalCommandFile();
|
$transport = new LocalCommandFile();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
'Can\'t create command transport \'%s\'. Invalid transport defined in \'%s\'.'
|
'Can\'t create command transport \'%s\'. Invalid transport defined in \'%s\'.'
|
||||||
. ' Use one of \'local\' or \'remote\'.',
|
. ' Use one of \'%s\' or \'%s\'.',
|
||||||
$config->transport,
|
$config->transport,
|
||||||
self::$config->getConfigFile()
|
self::$config->getConfigFile(),
|
||||||
|
LocalCommandFile::TRANSPORT,
|
||||||
|
RemoteCommandFile::TRANSPORT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
unset($config->transport);
|
unset($config->transport);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user