mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: dbUpdate calls now check if it is 0 or above (#4996)
This commit is contained in:
committed by
Tony Murray
parent
25d67c6d79
commit
7061acf508
@@ -43,7 +43,7 @@ if (!empty($name)) {
|
||||
if (substr($_REQUEST['rule_id'], -1, 1) != ",") {
|
||||
$_REQUEST['rule_id'] .= ",";
|
||||
}
|
||||
if (dbUpdate(array('rule_id' => mres($_REQUEST['rule_id']), 'name' => $name), "alert_templates", "id = ?", array($_REQUEST['template_id']))) {
|
||||
if (dbUpdate(array('rule_id' => mres($_REQUEST['rule_id']), 'name' => $name), "alert_templates", "id = ?", array($_REQUEST['template_id'])) >= 0) {
|
||||
$ok = "Updated template and rule id mapping";
|
||||
} else {
|
||||
$error ="Failed to update the template and rule id mapping";
|
||||
@@ -51,7 +51,7 @@ if (!empty($name)) {
|
||||
} elseif ($_REQUEST['template'] && is_numeric($_REQUEST['template_id'])) {
|
||||
//Update template-text
|
||||
|
||||
if ($ret = dbUpdate(array('template' => $_REQUEST['template'], 'name' => $name, 'title' => $_REQUEST['title'], 'title_rec' => $_REQUEST['title_rec']), "alert_templates", "id = ?", array($_REQUEST['template_id']))) {
|
||||
if (dbUpdate(array('template' => $_REQUEST['template'], 'name' => $name, 'title' => $_REQUEST['title'], 'title_rec' => $_REQUEST['title_rec']), "alert_templates", "id = ?", array($_REQUEST['template_id'])) >= 0) {
|
||||
$ok = "Updated template";
|
||||
} else {
|
||||
$error = "Failed to update the template";
|
||||
|
@@ -26,7 +26,7 @@ header('Content-type: application/json');
|
||||
$status = 'error';
|
||||
$message = 'unknown error';
|
||||
if (isset($_REQUEST['dashboard_id']) && isset($_REQUEST['dashboard_name']) && isset($_REQUEST['access'])) {
|
||||
if (dbUpdate(array('dashboard_name'=>$_REQUEST['dashboard_name'],'access'=>$_REQUEST['access']), 'dashboards', '(user_id = ? || access = 2) && dashboard_id = ?', array($_SESSION['user_id'],$_REQUEST['dashboard_id']))) {
|
||||
if (dbUpdate(array('dashboard_name'=>$_REQUEST['dashboard_name'],'access'=>$_REQUEST['access']), 'dashboards', '(user_id = ? || access = 2) && dashboard_id = ?', array($_SESSION['user_id'],$_REQUEST['dashboard_id'])) >= 0) {
|
||||
$status = 'ok';
|
||||
$message = 'Updated dashboard';
|
||||
} else {
|
||||
|
@@ -24,7 +24,7 @@ $group_name = mres($_POST['group_name']);
|
||||
$descr = mres($_POST['descr']);
|
||||
if (!empty($group_name)) {
|
||||
if (is_numeric($group_id)) {
|
||||
if (dbUpdate(array('group_name' => $group_name, 'descr' => $descr), 'poller_groups', 'id = ?', array($group_id))) {
|
||||
if (dbUpdate(array('group_name' => $group_name, 'descr' => $descr), 'poller_groups', 'id = ?', array($group_id)) >= 0) {
|
||||
$ok = 'Updated poller group';
|
||||
} else {
|
||||
$error = 'Failed to update the poller group';
|
||||
|
@@ -36,7 +36,7 @@ if (!is_numeric($device_id)) {
|
||||
} elseif (!is_numeric($data)) {
|
||||
$message = 'Missing value';
|
||||
} else {
|
||||
if (dbUpdate(array('storage_perc_warn'=>$data), 'storage', '`storage_id`=? AND `device_id`=?', array($storage_id,$device_id))) {
|
||||
if (dbUpdate(array('storage_perc_warn'=>$data), 'storage', '`storage_id`=? AND `device_id`=?', array($storage_id,$device_id)) >= 0) {
|
||||
$message = 'Storage information updated';
|
||||
$status = 'ok';
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user