Use isIcinga2() in command forms where needed
This commit is contained in:
parent
02eea2ad11
commit
5f8b994d5f
|
@ -124,7 +124,7 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
|
||||||
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state')
|
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (substr($this->getBackend()->getProgramVersion(), 0, 2) !== 'v2') {
|
if (! $this->getBackend()->isIcinga2()) {
|
||||||
$options[ProcessCheckResultCommand::HOST_UNREACHABLE] = $this->translate('UNREACHABLE', 'icinga.state');
|
$options[ProcessCheckResultCommand::HOST_UNREACHABLE] = $this->translate('UNREACHABLE', 'icinga.state');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (substr($this->getBackend()->getProgramVersion(), 0, 2) !== 'v2') {
|
if (! $this->getBackend()->isIcinga2()) {
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
'child_hosts',
|
'child_hosts',
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
|
||||||
'permission' => 'monitoring/command/feature/object/flap-detection'
|
'permission' => 'monitoring/command/feature/object/flap-detection'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (preg_match('~^[vr]2\.\d+\.\d+.*$~', $this->getIcingaVersion())) {
|
if ($this->getBackend()->isIcinga2()) {
|
||||||
unset($features[ToggleObjectFeatureCommand::FEATURE_OBSESSING]);
|
unset($features[ToggleObjectFeatureCommand::FEATURE_OBSESSING]);
|
||||||
}
|
}
|
||||||
$this->features = $features;
|
$this->features = $features;
|
||||||
|
@ -176,14 +176,4 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch and return the program version of the current instance
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function getIcingaVersion()
|
|
||||||
{
|
|
||||||
return $this->getBackend()->select()->from('programstatus', array('program_version'))->fetchOne();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue