mirror of https://github.com/MISP/MISP
fix: [settings] purge previous setting, push new one
parent
3d473ca29f
commit
43079f6dc1
|
@ -21,19 +21,19 @@ class AdminSetting extends AppModel
|
|||
$setting_object = $this->find('first', array(
|
||||
'conditions' => array('setting' => $setting)
|
||||
));
|
||||
if (!empty($setting_object)) {
|
||||
$setting_object['AdminSetting']['value'] = $value;
|
||||
} else {
|
||||
$this->create();
|
||||
$setting_object['AdminSetting'] = array('setting' => $setting, 'value' => $value);
|
||||
}
|
||||
$this->deleteAll('setting' => $setting);
|
||||
$this->create();
|
||||
$setting_object['AdminSetting'] = array('setting' => $setting, 'value' => $value);
|
||||
if ($this->save($setting_object)) {
|
||||
return true;
|
||||
} else {
|
||||
$this->create();
|
||||
$this->save($setting_object);
|
||||
return $this->validationErrors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getSetting($setting)
|
||||
{
|
||||
$setting_object = $this->find('first', array(
|
||||
|
|
Loading…
Reference in New Issue