Summary
weathermap_setting_save() uses REPLACE INFO instead of REPLACE INTO in all three branches. This is a SQL syntax error that breaks every call site.
Location
weathermap-cacti-plugin-mgmt.php (or wherever weathermap_setting_save() is defined)
db_execute_prepared('REPLACE INFO weathermap_settings ...
Should be:
db_execute_prepared('REPLACE INTO weathermap_settings ...
Additional DRY opportunity
The three branches in the function are structurally identical, differing only in which of mapid/groupid gets set. Consolidatable to:
function weathermap_setting_save($mapid, $name, $value) {
[$map_val, $grp_val] = $mapid > 0
? [$mapid, 0]
: ($mapid < 0 ? [0, -$mapid] : [0, 0]);
db_execute_prepared('REPLACE INTO weathermap_settings
(mapid, groupid, optname, optvalue)
VALUES (?, ?, ?, ?)',
[$map_val, $grp_val, $name, $value]);
}
Bug fix and DRY cleanup in one commit.
Summary
weathermap_setting_save()usesREPLACE INFOinstead ofREPLACE INTOin all three branches. This is a SQL syntax error that breaks every call site.Location
weathermap-cacti-plugin-mgmt.php(or whereverweathermap_setting_save()is defined)db_execute_prepared('REPLACE INFO weathermap_settings ...Should be:
db_execute_prepared('REPLACE INTO weathermap_settings ...Additional DRY opportunity
The three branches in the function are structurally identical, differing only in which of
mapid/groupidgets set. Consolidatable to:Bug fix and DRY cleanup in one commit.