mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-25 14:54:25 +02:00
IcingaHost, IcingaServiceForm: fix parse error...
...on PHP < 5.5
This commit is contained in:
parent
6cc1a90b0a
commit
8dd7fcd13b
@ -279,19 +279,19 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||||||
protected function succeedForOverrides()
|
protected function succeedForOverrides()
|
||||||
{
|
{
|
||||||
|
|
||||||
$vars = (object) array();
|
$vars = array();
|
||||||
foreach ($this->object->vars() as $key => $var) {
|
foreach ($this->object->vars() as $key => $var) {
|
||||||
$vars->$key = $var->getValue();
|
$vars[$key] = $var->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
$host = $this->host;
|
$host = $this->host;
|
||||||
$serviceName = $this->object->object_name;
|
$serviceName = $this->object->object_name;
|
||||||
|
|
||||||
$this->host->overrideServiceVars($serviceName, $vars);
|
$this->host->overrideServiceVars($serviceName, (object) $vars);
|
||||||
|
|
||||||
if ($host->hasBeenModified()) {
|
if ($host->hasBeenModified()) {
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
empty((array) $vars)
|
empty($vars)
|
||||||
? $this->translate('All overrides have been removed from "%s"')
|
? $this->translate('All overrides have been removed from "%s"')
|
||||||
: $this->translate('The given properties have been stored for "%s"'),
|
: $this->translate('The given properties have been stored for "%s"'),
|
||||||
$this->translate($host->object_name)
|
$this->translate($host->object_name)
|
||||||
|
@ -239,7 +239,9 @@ class IcingaHost extends IcingaObject
|
|||||||
|
|
||||||
public function overrideServiceVars($service, $vars)
|
public function overrideServiceVars($service, $vars)
|
||||||
{
|
{
|
||||||
if (empty((array) $vars)) {
|
// For PHP < 5.5.0:
|
||||||
|
$array = (array) $vars;
|
||||||
|
if (empty($array)) {
|
||||||
return $this->unsetOverriddenServiceVars($service);
|
return $this->unsetOverriddenServiceVars($service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user