mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
Db: improve master zone detection
This also speeds up config generation
This commit is contained in:
parent
44e1302ba2
commit
5cc28ac4a6
@ -21,6 +21,8 @@ class Db extends DbConnection
|
||||
|
||||
protected $settings;
|
||||
|
||||
protected $masterZoneName;
|
||||
|
||||
protected function db()
|
||||
{
|
||||
return $this->getDbAdapter();
|
||||
@ -60,6 +62,15 @@ class Db extends DbConnection
|
||||
}
|
||||
|
||||
public function getMasterZoneName()
|
||||
{
|
||||
if ($this->masterZoneName === null) {
|
||||
$this->masterZoneName = $this->detectMasterZoneName();
|
||||
}
|
||||
|
||||
return $this->masterZoneName;
|
||||
}
|
||||
|
||||
protected function detectMasterZoneName()
|
||||
{
|
||||
if ($zone = $this->getSetting('master_zone')) {
|
||||
return $zone;
|
||||
@ -68,6 +79,7 @@ class Db extends DbConnection
|
||||
$db = $this->db();
|
||||
$query = $db->select()
|
||||
->from('icinga_zone', 'object_name')
|
||||
->where('parent_id IS NULL')
|
||||
->where('is_global = ?', 'n');
|
||||
|
||||
$zones = $db->fetchCol($query);
|
||||
|
Loading…
x
Reference in New Issue
Block a user