mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-01 11:04:24 +02:00
Add MonitoringBackend::isIcinga2()
This function is for the many places where we have to distinguish between Icinga 1.x and Icinga 2.x. refs #11100
This commit is contained in:
parent
1bbb7a3118
commit
47b3019940
@ -341,4 +341,22 @@ class MonitoringBackend implements Selectable, Queryable, ConnectionInterface
|
|||||||
{
|
{
|
||||||
return $this->select()->from('programstatus', array('program_version'))->fetchOne();
|
return $this->select()->from('programstatus', array('program_version'))->fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether the backend is Icinga 2
|
||||||
|
*
|
||||||
|
* @param string $programVersion
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isIcinga2($programVersion = null)
|
||||||
|
{
|
||||||
|
if ($programVersion === null) {
|
||||||
|
$programVersion = $this->select()->from('programstatus', array('program_version'))->fetchOne();
|
||||||
|
}
|
||||||
|
return (bool) preg_match(
|
||||||
|
'/^[vr]2\.\d+\.\d+.*$/',
|
||||||
|
$programVersion
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user