Remove node before recreating it upon edit

Else you may run into errors that objects have been defined twice.
This commit is contained in:
Eric Lippmann 2018-07-31 12:59:49 +02:00
parent f4a3fcc81b
commit 99a66a4b4b

View file

@ -443,6 +443,9 @@ class EditNodeForm extends QuickForm
public function onSuccess()
{
$changes = ProcessChanges::construct($this->bp, $this->session);
$changes->deleteNode($this->node, $this->parent->getName());
switch ($this->getValue('node_type')) {
case 'host':
case 'service':
@ -459,8 +462,6 @@ class EditNodeForm extends QuickForm
break;
}
$changes->deleteNode($this->node, $this->parent->getName());
// Trigger session destruction to make sure it get's stored.
// TODO: figure out why this is necessary, might be an unclean shutdown on redirect
unset($changes);