mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaTimeperiodRanges(Legacy): Implement toLegacyConfigString
refs #12919
This commit is contained in:
parent
ab7d0fb085
commit
f2ff967b07
@ -1912,6 +1912,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function renderLegacyRanges()
|
||||||
|
{
|
||||||
|
if ($this->supportsRanges()) {
|
||||||
|
return $this->ranges()->toLegacyConfigString();
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
@ -2030,7 +2041,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
$this->renderLegacyObjectHeader(),
|
$this->renderLegacyObjectHeader(),
|
||||||
$this->renderLegacyImports(),
|
$this->renderLegacyImports(),
|
||||||
$this->renderLegacyProperties(),
|
$this->renderLegacyProperties(),
|
||||||
//$this->renderRanges(),
|
$this->renderLegacyRanges(),
|
||||||
//$this->renderArguments(),
|
//$this->renderArguments(),
|
||||||
//$this->renderRelatedSets(),
|
//$this->renderRelatedSets(),
|
||||||
$this->renderLegacyGroups(),
|
$this->renderLegacyGroups(),
|
||||||
|
@ -7,6 +7,7 @@ use Iterator;
|
|||||||
use Countable;
|
use Countable;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
|
||||||
|
|
||||||
class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRenderer
|
class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRenderer
|
||||||
{
|
{
|
||||||
@ -286,4 +287,25 @@ class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRendere
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toLegacyConfigString()
|
||||||
|
{
|
||||||
|
if (empty($this->ranges) && $this->object->object_type === 'template') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
foreach ($this->ranges as $range) {
|
||||||
|
$out .= c1::renderKeyValue(
|
||||||
|
$range->range_key,
|
||||||
|
$range->range_value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($out !== '') {
|
||||||
|
$out = "\n".$out;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user