diff --git a/library/Businessprocess/BpConfig.php b/library/Businessprocess/BpConfig.php index 1d8b032..548d09d 100644 --- a/library/Businessprocess/BpConfig.php +++ b/library/Businessprocess/BpConfig.php @@ -12,6 +12,8 @@ use Icinga\Exception\NotFoundError; use Icinga\Module\Businessprocess\Exception\NestingError; use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; +use Icinga\Module\Businessprocess\State\IcingaDbState; +use Icinga\Module\Businessprocess\State\MonitoringState; use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Monitoring\Backend\MonitoringBackend; use ipl\Sql\Connection as IcingaDbConnection; @@ -177,6 +179,15 @@ class BpConfig */ public function applyChanges(ProcessChanges $changes) { + if ( + Module::exists('icingadb') + && (! $this->hasBackendName() && IcingadbSupport::useIcingaDbAsBackend()) + ) { + IcingaDbState::apply($this); + } else { + MonitoringState::apply($this); + } + $cnt = 0; foreach ($changes->getChanges() as $change) { $cnt++; diff --git a/library/Businessprocess/Web/Controller.php b/library/Businessprocess/Web/Controller.php index d8d1d63..71eac44 100644 --- a/library/Businessprocess/Web/Controller.php +++ b/library/Businessprocess/Web/Controller.php @@ -199,7 +199,11 @@ class Controller extends CompatController $changes->clear(); $this->redirectNow($this->url()->without('dismissChanges')->without('unlocked')); } - $bp->applyChanges($changes); + + if (! $changes->isEmpty()) { + $bp->applyChanges($changes); + } + return $bp; }