mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaTimePeriodRanges: improve "modified" handling
Seems to be currently unused nonetheless
This commit is contained in:
parent
14223712eb
commit
bf8108d937
@ -89,7 +89,12 @@ class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRendere
|
|||||||
{
|
{
|
||||||
foreach ($ranges as $range => $value) {
|
foreach ($ranges as $range => $value) {
|
||||||
if (array_key_exists($range, $this->ranges)) {
|
if (array_key_exists($range, $this->ranges)) {
|
||||||
$this->ranges[$range]->timeperiod_value = $value;
|
if ($this->ranges[$range]->timeperiod_value === $value) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
$this->ranges[$range]->timeperiod_value = $value;
|
||||||
|
$this->modified = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->ranges[$range] = IcingaTimePeriodRange::create(array(
|
$this->ranges[$range] = IcingaTimePeriodRange::create(array(
|
||||||
'timeperiod_id' => $this->object->id,
|
'timeperiod_id' => $this->object->id,
|
||||||
@ -102,6 +107,7 @@ class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRendere
|
|||||||
$toDelete = array_diff(array_keys($this->ranges), array_keys($ranges));
|
$toDelete = array_diff(array_keys($this->ranges), array_keys($ranges));
|
||||||
foreach ($toDelete as $range) {
|
foreach ($toDelete as $range) {
|
||||||
$this->remove($range);
|
$this->remove($range);
|
||||||
|
$this->modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -208,7 +214,7 @@ class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRendere
|
|||||||
|
|
||||||
public function toConfigString()
|
public function toConfigString()
|
||||||
{
|
{
|
||||||
if (empty($this->ranges) && $this->object->object_type == 'template') {
|
if (empty($this->ranges) && $this->object->object_type === 'template') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user