mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaConfig: separate modification check from store
This commit is contained in:
parent
bf7001510f
commit
e02e61abd4
@ -89,17 +89,30 @@ class IcingaConfig
|
|||||||
return $config->storeIfModified();
|
return $config->storeIfModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function storeIfModified()
|
protected function hasBeenModified()
|
||||||
{
|
{
|
||||||
$this->generateFromDb();
|
$this->generateFromDb();
|
||||||
$this->collectExtraFiles();
|
$this->collectExtraFiles();
|
||||||
$checksum = $this->calculateChecksum();
|
$checksum = $this->calculateChecksum();
|
||||||
$exists = $this->db->fetchOne(
|
$exists = $this->db->fetchOne(
|
||||||
$this->db->select()->from(self::$table, 'COUNT(*)')->where('checksum = ?', $this->dbBin($checksum))
|
$this->db->select()->from(
|
||||||
|
self::$table,
|
||||||
|
'COUNT(*)'
|
||||||
|
)->where(
|
||||||
|
'checksum = ?',
|
||||||
|
$this->dbBin($checksum)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
if ((int) $exists === 0) {
|
|
||||||
|
return (int) $exists === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function storeIfModified()
|
||||||
|
{
|
||||||
|
if ($this->hasBeenModified()) {
|
||||||
$this->store();
|
$this->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user